{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "7E039B98-76DD-4C06-9596-020EC90D6286",
    "name": "DocuSign: declined rate con sent to dispatch"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -55.474271543707374,
        "y": 5.2820830750155,
        "zoom": 0.87
      },
      "autoSave": false,
      "descriptions": {
        "flow": "When a carrier declines a rate con in DocuSign, reads who declined and why, finds the load in McLeod and posts the reason next to the lane, pickup and carrier pay in Slack. Other declined envelopes go to Slack with the reason.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "When a carrier declines a rate con in DocuSign, reads who declined and why, finds the load in McLeod and posts the reason next to the lane, pickup and carrier pay in Slack. Other declined envelopes go to Slack with the reason.",
    "elements": [
      {
        "clientMetadata": {
          "notes": "Sends messages to Slack channels with optional Block Kit rich layouts. Supports plain text with Slack formatting, or advanced Block Kit JSON for buttons, menus, and interactive elements. Returns the message timestamp and channel ID for later updates or tracking.",
          "elementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Tell the dispatcher Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 418,
            "y": 210
          }
        },
        "flowElementId": "D2C59702-1D6D-4D50-8BD1-224612A264A0",
        "groupId": null,
        "id": "BFB3AAFB-6263-4757-8F8E-0AD1097BB649",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageText",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Dispatch note",
                    "subPathSegments": [
                      {
                        "key": "text",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "FE9F6DEC-54F1-46B7-96FE-1A8A90668B80"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "threadId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sendAsBot",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botIcon",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "replyBroadcast",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "imageURL",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "blocks",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Dispatch note",
                    "subPathSegments": [
                      {
                        "key": "blocks",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "FE9F6DEC-54F1-46B7-96FE-1A8A90668B80"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "sendMessageToChannel",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Dispatch message",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell the dispatcher",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Finds a load by its order number, PRO number, bill of lading, consignee reference or a stop reference number (McLeod order tracking search) and returns the first match in full, as Get Load does, with every match listed. Returns found: false instead of failing when nothing matches.",
          "elementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::findLoadByNumber",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the load in McLeod Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::findLoadByNumber",
          "legacyElementId": null,
          "methodName": "findLoadByNumber",
          "position": {
            "x": 1069,
            "y": 210
          }
        },
        "flowElementId": "A13D63F4-471B-4278-989E-AF36C44B003C",
        "groupId": null,
        "id": "64E5D1E3-62C0-4784-9E11-59F85B960D96",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "loadNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Decline",
                    "subPathSegments": [
                      {
                        "key": "loadNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8146F59B-892F-4E91-9A22-DB05EA5CB536"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "proNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "billOfLading",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "consigneeReference",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "referenceNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "findLoadByNumber",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "McLeod load",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "mcleod-loadmaster",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the load in McLeod",
        "nextElementIds": [
          "FE9F6DEC-54F1-46B7-96FE-1A8A90668B80"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Read the decline Result"
          },
          "position": {
            "x": 747,
            "y": 49
          }
        },
        "flowElementId": "CCA17AF8-CEAC-4EE5-93C7-CC4D170F786B",
        "groupId": null,
        "id": "8146F59B-892F-4E91-9A22-DB05EA5CB536",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "subject",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Declined envelope",
                    "subPathSegments": [
                      {
                        "key": "emailSubject",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "6C235286-E48A-497C-B7AA-BF32086A8C8C"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "signers",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Recipients",
                    "subPathSegments": [
                      {
                        "key": "signers",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "30A1E9F9-0DEE-4471-B582-2529917D51B1"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "eventRecipients",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Declined envelope",
                    "subPathSegments": [
                      {
                        "key": "recipients",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "6C235286-E48A-497C-B7AA-BF32086A8C8C"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sender",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Declined envelope",
                    "subPathSegments": [
                      {
                        "key": "sender",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "6C235286-E48A-497C-B7AA-BF32086A8C8C"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "envelopeId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Declined envelope",
                    "subPathSegments": [
                      {
                        "key": "envelopeId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "6C235286-E48A-497C-B7AA-BF32086A8C8C"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const s = String(subject || '');\nconst list = [].concat(Array.isArray(signers) ? signers : [], Array.isArray(eventRecipients) ? eventRecipients : []);\nconst who = list.find(r => String(r.status || '').toLowerCase() === 'declined') || list[0] || {};\nconst isRateCon = /rate\\s*con(firmation)?/i.test(s);\nconst m = s.match(/(?:load|order)\\s*(?:#|no\\.?|number)?\\s*:?\\s*([A-Z0-9][A-Z0-9-]{2,})/i);\nreturn {\n  isRateCon: isRateCon && !!m,\n  loadNumber: m ? m[1] : '',\n  subject: s || 'an envelope',\n  who: who.name || who.email || 'The signer',\n  email: who.email || '',\n  reason: who.declinedReason || 'No reason given',\n  sender: (sender && (sender.name || sender.email)) || 'the sender',\n  link: `https://app.docusign.com/documents/details/${envelopeId}`,\n};"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Decline",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Read the decline",
        "nextElementIds": [
          "3503F6CB-0993-4546-A194-427279962FD4"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Retrieves all recipients of a DocuSign envelope with their signing status, delivery timestamps, and role information. Returns signers, carbon copy recipients, and other recipient types with their individual completion status.",
          "elementId": "EXTENSION:::SHARED:::default:::docusign:::getEnvelopeRecipients",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Who declined and why Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::docusign:::getEnvelopeRecipients",
          "legacyElementId": "JS###v1###DocuSignService###getEnvelopeRecipients",
          "methodName": "getEnvelopeRecipients",
          "position": {
            "x": 410,
            "y": 40
          }
        },
        "flowElementId": "A0671C5F-72C3-49C4-8968-5B9F28405B01",
        "groupId": null,
        "id": "30A1E9F9-0DEE-4471-B582-2529917D51B1",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "envelopeId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Declined envelope",
                    "subPathSegments": [
                      {
                        "key": "envelopeId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "6C235286-E48A-497C-B7AA-BF32086A8C8C"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Who declined and why', Error: OAuth Connection is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "getEnvelopeRecipients",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Recipients",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "docusign",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Who declined and why",
        "nextElementIds": [
          "8146F59B-892F-4E91-9A22-DB05EA5CB536"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Sends messages to Slack channels with optional Block Kit rich layouts. Supports plain text with Slack formatting, or advanced Block Kit JSON for buttons, menus, and interactive elements. Returns the message timestamp and channel ID for later updates or tracking.",
          "elementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Post other declines to Slack Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 1392,
            "y": 40
          }
        },
        "flowElementId": "C0A46CDB-DAC8-4233-9808-0AAB691F68BA",
        "groupId": null,
        "id": "E079922C-8F79-494F-B16E-6584A3CE2ACF",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageText",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Decline",
                    "subPathSegments": [
                      {
                        "key": "who",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8146F59B-892F-4E91-9A22-DB05EA5CB536"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " declined \""
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Decline",
                    "subPathSegments": [
                      {
                        "key": "subject",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8146F59B-892F-4E91-9A22-DB05EA5CB536"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "\" in DocuSign. Reason: "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Decline",
                    "subPathSegments": [
                      {
                        "key": "reason",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8146F59B-892F-4E91-9A22-DB05EA5CB536"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". Sent by "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Decline",
                    "subPathSegments": [
                      {
                        "key": "sender",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8146F59B-892F-4E91-9A22-DB05EA5CB536"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". <"
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Decline",
                    "subPathSegments": [
                      {
                        "key": "link",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8146F59B-892F-4E91-9A22-DB05EA5CB536"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "|Open the envelope in DocuSign>"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "threadId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sendAsBot",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botIcon",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "replyBroadcast",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "imageURL",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "blocks",
              "type": "COMPLEX_LIST",
              "value": []
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "sendMessageToChannel",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Other decline message",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Post other declines to Slack",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1081,
            "y": 49
          }
        },
        "flowElementId": "F6C8A28D-CE2C-45C8-BABA-24D4CBAA3435",
        "groupId": null,
        "id": "3503F6CB-0993-4546-A194-427279962FD4",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "11f6b1f0-892c-4a26-8a72-16bef55ef6e5",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Decline",
                      "subPathSegments": [
                        {
                          "key": "isRateCon",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "8146F59B-892F-4E91-9A22-DB05EA5CB536"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "11f6b1f0-892c-4a26-8a72-16bef55ef6e5"
            ]
          },
          "elseComponent": {
            "componentId": "E079922C-8F79-494F-B16E-6584A3CE2ACF",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Rate con check",
          "storeResult": false,
          "thenComponent": {
            "componentId": "64E5D1E3-62C0-4784-9E11-59F85B960D96",
            "componentType": "ELEMENT"
          }
        },
        "name": "Rate con for a load?",
        "nextElementIds": [
          "64E5D1E3-62C0-4784-9E11-59F85B960D96",
          "E079922C-8F79-494F-B16E-6584A3CE2ACF"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Write the note for dispatch Result"
          },
          "position": {
            "x": 725,
            "y": 219
          }
        },
        "flowElementId": "438A21AF-46E3-4636-BBAF-7285DC249D68",
        "groupId": null,
        "id": "FE9F6DEC-54F1-46B7-96FE-1A8A90668B80",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "who",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Decline",
                    "subPathSegments": [
                      {
                        "key": "who",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8146F59B-892F-4E91-9A22-DB05EA5CB536"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "reason",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Decline",
                    "subPathSegments": [
                      {
                        "key": "reason",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8146F59B-892F-4E91-9A22-DB05EA5CB536"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "loadNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Decline",
                    "subPathSegments": [
                      {
                        "key": "loadNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8146F59B-892F-4E91-9A22-DB05EA5CB536"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "link",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Decline",
                    "subPathSegments": [
                      {
                        "key": "link",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8146F59B-892F-4E91-9A22-DB05EA5CB536"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "found",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "McLeod load",
                    "subPathSegments": [
                      {
                        "key": "found",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "64E5D1E3-62C0-4784-9E11-59F85B960D96"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "loadData",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "McLeod load",
                    "subPathSegments": [
                      {
                        "key": "load",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "64E5D1E3-62C0-4784-9E11-59F85B960D96"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const load = found && loadData ? loadData : null;\nconst stops = (load && Array.isArray(load.stops)) ? load.stops : [];\nconst first = stops[0];\nconst last = stops[stops.length - 1];\nconst place = (s) => s ? [s.city, s.state].filter(Boolean).join(', ') : '';\nconst time = (t) => t ? String(t).slice(0, 16).replace('T', ' ') : '';\nconst move = load && Array.isArray(load.movements) ? load.movements[0] : null;\nconst carrier = (move && move.carrier && move.carrier.name) || (load && load.carrier && load.carrier.name) || '';\nconst pay = load && load.carrierPay && load.carrierPay.totalPay;\nconst lines = [\n  `*${who} declined the rate con for load ${loadNumber}*`,\n  `Reason: ${reason}`,\n];\nif (load) {\n  if (carrier) lines.push(`Carrier in McLeod: ${carrier}${move && move.carrierPhone ? `, ${move.carrierPhone}` : ''}`);\n  if (first && last) lines.push(`Lane: ${place(first)} to ${place(last)}`);\n  if (first && first.scheduledArriveEarly) lines.push(`Pickup: ${time(first.scheduledArriveEarly)}${first.scheduledArriveLate ? ` to ${time(first.scheduledArriveLate)}` : ''}`);\n  if (pay != null) lines.push(`Carrier pay in McLeod: $${Number(pay).toFixed(2)}`);\n  lines.push(`Status in McLeod: ${load.statusDescription || load.status || 'unknown'}`);\n} else {\n  lines.push(`No load ${loadNumber} was found in McLeod.`);\n}\nlines.push(`<${link}|Open the envelope in DocuSign>`);\nreturn {\n  text: `${who} declined the rate con for load ${loadNumber}: ${reason}`,\n  blocks: [ { type: 'section', text: { type: 'mrkdwn', text: lines.join('\\n') } } ],\n};"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Dispatch note",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Write the note for dispatch",
        "nextElementIds": [
          "BFB3AAFB-6263-4757-8F8E-0AD1097BB649"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Triggered when a recipient declines to sign an envelope. Use this to handle rejection scenarios such as sending notifications, escalating to managers, or initiating alternative workflows.",
          "elementId": "EXTENSION:::SHARED:::default:::docusign:::onEnvelopeDeclined",
          "isFirstElement": true,
          "blockDefinitionId": "api-service-trigger",
          "newElementId": "EXTENSION:::SHARED:::default:::docusign:::onEnvelopeDeclined",
          "legacyElementId": "JS###v1###DocuSignService###onEnvelopeDeclined",
          "methodName": "onEnvelopeDeclined",
          "position": {
            "x": 110,
            "y": 40
          }
        },
        "flowElementId": "A859A2AF-3A2C-44A3-B38D-009EE5CB752F",
        "groupId": null,
        "id": "6C235286-E48A-497C-B7AA-BF32086A8C8C",
        "metaInfo": {
          "callbackUrl": null,
          "clientValidationState": {
            "errorMessage": "Block: 'Envelope declined', Error: OAuth Connection is required",
            "valid": false
          },
          "condition": null,
          "connectionId": null,
          "eventName": "onEnvelopeDeclined",
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Declined envelope",
          "scope": "SINGLE_APP",
          "serviceId": "docusign",
          "slaConditions": [],
          "staticData": {},
          "storeResult": true,
          "subtype": "REALTIME",
          "type": "CUSTOM"
        },
        "name": "Envelope declined",
        "nextElementIds": [
          "30A1E9F9-0DEE-4471-B582-2529917D51B1"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      }
    ],
    "firstElementId": "6C235286-E48A-497C-B7AA-BF32086A8C8C",
    "groups": [],
    "id": "DB20D26A-84D8-4F70-8F24-CD53D64D1770",
    "metaInfo": {
      "clientValidationState": {
        "errorMessage": "Please fix problems before start. Blocks with issues have red badge in the top-right corner of a block, hover it to see what needs to be done.",
        "valid": false
      },
      "errorMessage": "Please fix problems before start. Blocks with issues have red badge in the top-right corner of a block, hover it to see what needs to be done.",
      "executionStaticData": [],
      "initialData": null,
      "initialDataDefaultValues": {},
      "ownerFlowVersionId": null,
      "schedule": null,
      "sharedMemory": {
        "anchor": {
          "missingAnchorPolicy": null,
          "path": null,
          "type": "FLOW_MEMORY"
        },
        "expirationInSec": null
      },
      "wasLive": false
    }
  },
  "slaCalendars": [],
  "slaGoals": [],
  "subFlows": [],
  "exportDate": "2026-11-26T09:36:56.834Z"
}
