{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "C5205F22-1714-426C-8637-43FEF491BD44",
    "name": "McLeod: delivered load to invoice with POD"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -43.33333333333333,
        "y": 9.696969696969695,
        "zoom": 0.76
      },
      "autoSave": false,
      "descriptions": {
        "flow": "When a load turns Delivered in McLeod LoadMaster, finds its POD in McLeod Imaging, creates the QuickBooks Online invoice from the McLeod customer charges with the load number as the invoice number (or finds the one already there) and attaches the POD. With no POD on file, dispatch is asked in Slack to chase it and the invoice waits.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "When a load turns Delivered in McLeod LoadMaster, finds its POD in McLeod Imaging, creates the QuickBooks Online invoice from the McLeod customer charges with the load number as the invoice number (or finds the one already there) and attaches the POD. With no POD on file, dispatch is asked in Slack to chase it and the invoice waits.",
    "elements": [
      {
        "clientMetadata": {
          "notes": "Gets one load (McLeod order) by its order ID: status, customer, every stop with its scheduled window and actual arrival and departure, piece count and weight, the customer charges (other charges), and for each movement the carrier, the agreed carrier pay and the carrier extra pay, plus the full McLeod records.",
          "elementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::getLoad",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Get the load Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::getLoad",
          "legacyElementId": null,
          "methodName": "getLoad",
          "position": {
            "x": 523,
            "y": 40
          }
        },
        "flowElementId": "9B622694-F587-4513-A835-0A2ED3C952BA",
        "groupId": null,
        "id": "17A36124-80DE-433C-9637-B51987329551",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "orderId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Delivered load",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "45A9EC7F-5386-41B2-A616-4FD31219E643"
                  }
                ],
                "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": "getLoad",
          "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": "Get the load",
        "nextElementIds": [
          "61DE685C-5F98-455F-82ED-754967304FF3"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Fires when a load's (McLeod order's) status changes, for example to In Progress or Delivered, with the previous and new status. McLeod cannot register webhooks, so this polls the orders changed since the last check (it needs table auditing on orders, as McLeod's changed-after search does). It starts from the Available and In Progress loads (up to 2,000); a load in another status when the trigger starts is reported from its second change on.",
          "elementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::onLoadStatusChanged",
          "isFirstElement": true,
          "blockDefinitionId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::onLoadStatusChanged",
          "newElementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::onLoadStatusChanged",
          "legacyElementId": null,
          "methodName": "onLoadStatusChanged",
          "position": {
            "x": 125,
            "y": 40
          }
        },
        "flowElementId": "37FDD272-5BD6-41E8-95A7-12825A86ACB6",
        "groupId": null,
        "id": "45A9EC7F-5386-41B2-A616-4FD31219E643",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": null,
          "connectionId": null,
          "dynamicData": [],
          "eventName": "onLoadStatusChanged",
          "frequency": {
            "repeat": {
              "every": 900
            },
            "schedule": "custom"
          },
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Delivered load",
          "serviceId": "mcleod-loadmaster",
          "slaConditions": [],
          "staticData": {
            "statuses": [
              "D"
            ]
          },
          "storeResult": true,
          "subtype": "POLLING",
          "type": "CUSTOM"
        },
        "name": "Load delivered in McLeod",
        "nextElementIds": [
          "17A36124-80DE-433C-9637-B51987329551"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "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,
          "dynamicOptionLabels": {
            "channelId": {}
          },
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Ask dispatch to chase the POD Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 894,
            "y": 340
          }
        },
        "flowElementId": "97A69EFC-1DC6-4532-9201-725355D8C999",
        "groupId": null,
        "id": "0A486F7E-2F8D-4713-A148-54429B7D08C0",
        "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": "POD pick",
                    "subPathSegments": [
                      {
                        "key": "chaseText",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CE5DDC34-A7AF-4D2E-903E-2CC97FBCE645"
                  }
                ],
                "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": "POD chase note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Ask dispatch to chase the POD",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Downloads one document from McLeod Imaging, converted to the chosen format (PDF by default, which keeps every page of a multi-page TIFF), and saves it to FlowRunner file storage. Returns the stored file's URL.",
          "elementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::downloadDocument",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Download the POD Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::downloadDocument",
          "legacyElementId": null,
          "methodName": "downloadDocument",
          "position": {
            "x": 930,
            "y": 210
          }
        },
        "flowElementId": "6F550963-23C8-4500-8C44-0D76780A9AB3",
        "groupId": null,
        "id": "8D4EC5FD-0A2B-404C-A7A6-E4191E9CC458",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "documentId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "POD pick",
                    "subPathSegments": [
                      {
                        "key": "documentId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CE5DDC34-A7AF-4D2E-903E-2CC97FBCE645"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "format",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "application/pdf"
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "POD pick",
                    "subPathSegments": [
                      {
                        "key": "fileName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CE5DDC34-A7AF-4D2E-903E-2CC97FBCE645"
                  }
                ],
                "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": "downloadDocument",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "POD file",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "mcleod-loadmaster",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Download the POD",
        "nextElementIds": [
          "E95B37EF-6D66-4519-A374-0D1B79FF0385"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "router",
          "isFirstElement": false,
          "blockDefinitionId": "router",
          "casesViewMode": {
            "dc0c7722-2eb1-4d1e-8d0f-ae3d827f1d04": "SIMPLE",
            "2e88f454-0f87-45c2-ae0a-dc704373d64a": "SIMPLE"
          },
          "position": {
            "x": 1289,
            "y": 819
          }
        },
        "flowElementId": "806D32BC-9DE6-4A93-ADDC-645BB7880A0D",
        "groupId": null,
        "id": "23A57DC8-DB52-4DE9-B105-F3A1C5D8CF34",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Invoice route",
          "storeResult": true,
          "switchCases": [
            {
              "defaultCase": false,
              "id": "dc0c7722-2eb1-4d1e-8d0f-ae3d827f1d04",
              "label": "Yes: attach the POD to it",
              "nextComponents": [
                {
                  "componentId": "EDF852C7-2D57-4C50-A736-6FF13B8F0CBD",
                  "componentType": "ELEMENT"
                }
              ],
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "attach"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "defaultCase": false,
              "id": "2e88f454-0f87-45c2-ae0a-dc704373d64a",
              "label": "No: create the invoice",
              "nextComponents": [
                {
                  "componentId": "701AD7F7-C691-4C01-B679-38B5C7F6923C",
                  "componentType": "ELEMENT"
                }
              ],
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "create"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "defaultCase": true,
              "id": "b4c768ee-c123-40aa-9c6f-8698c97166f7",
              "label": "Everything Else",
              "nextComponents": [
                {
                  "componentId": "32247D56-131E-4B76-BBD9-7ED46B7F8FF5",
                  "componentType": "ELEMENT"
                }
              ],
              "type": "SIMPLE",
              "value": null
            }
          ],
          "switchExpression": {
            "expression": [
              {
                "id": "ELEMENT_RESULT",
                "label": "Invoice plan",
                "subPathSegments": [
                  {
                    "key": "outcome",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "D4FF5811-FAA3-41E5-93A4-98411C0B0DC6"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          }
        },
        "name": "Invoice already in QuickBooks?",
        "nextElementIds": [
          "EDF852C7-2D57-4C50-A736-6FF13B8F0CBD",
          "701AD7F7-C691-4C01-B679-38B5C7F6923C",
          "32247D56-131E-4B76-BBD9-7ED46B7F8FF5"
        ],
        "nextGroupIds": [],
        "type": "VALUE_ROUTER"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Pick out the POD Result"
          },
          "position": {
            "x": 1325,
            "y": 49
          }
        },
        "flowElementId": "FD0EAE22-1F33-404F-A2AA-EC8A66E132D0",
        "groupId": null,
        "id": "CE5DDC34-A7AF-4D2E-903E-2CC97FBCE645",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "docList",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Load documents",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "61DE685C-5F98-455F-82ED-754967304FF3"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "podType",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "POD document type",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "POD document type"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "load",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "McLeod load",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "17A36124-80DE-433C-9637-B51987329551"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const docs = docList && Array.isArray(docList.documents) ? docList.documents : [];\nconst wanted = String(podType || '').trim().toLowerCase();\nconst isPod = (d) => String(d.documentTypeId || '').trim().toLowerCase() === wanted || /proof of delivery|\\bpod\\b/i.test(String(d.description || ''));\nconst pods = docs.filter(isPod).sort((a, b) => String(b.scanDate || '').localeCompare(String(a.scanDate || '')));\nconst pod = pods[0] || null;\nconst l = load && typeof load === 'object' ? load : {};\nconst moves = Array.isArray(l.movements) ? l.movements : [];\nconst movement = moves.find((m) => String(m.movementId) === String(l.currentMovementId)) || moves[moves.length - 1] || {};\nconst carrier = (movement.carrier && movement.carrier.name) || (l.carrier && l.carrier.name) || 'the carrier';\nconst contact = [movement.carrierContact, movement.carrierPhone, movement.carrierEmail].filter(Boolean).join(', ');\nconst stops = Array.isArray(l.stops) ? l.stops : [];\nconst last = stops[stops.length - 1] || {};\nconst delivered = last.actualDeparture || last.actualArrival || '';\nconst chaseText = [\n  `*Load ${l.orderId} is delivered in McLeod, but no POD is on file.*`,\n  `Customer: ${(l.customer && l.customer.name) || 'unknown'}` + `\\nCarrier: ${carrier}` + (movement.proNumber ? `, PRO ${movement.proNumber}` : ''),\n  contact ? `Carrier contact: ${contact}.` : 'McLeod has no carrier contact on the movement.',\n  delivered ? `Delivered at ${last.locationName || last.city || 'the last stop'}: ${delivered}.` : null,\n  'Please ask the carrier for the signed POD. The customer invoice waits until the POD is filed on the load.',\n].filter(Boolean).join('\\n');\nreturn {\n  found: Boolean(pod),\n  documentId: pod ? String(pod.documentId) : '',\n  fileName: `pod-${l.orderId}.pdf`,\n  chaseText,\n};\n"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "POD pick",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Pick out the POD",
        "nextElementIds": [
          "95532339-C2F6-453B-B478-F1735EF73916"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Attaches a file, such as a proof of delivery or a signed timesheet, to an existing invoice in QuickBooks Online. The file is downloaded from the given URL (for example a FlowRunner file URL from an earlier step) and uploaded as an attachment linked to the invoice. Turn on Include When Sending to email it with the invoice. Returns the created attachment.",
          "elementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::attachFileToInvoice",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Attach the POD to the new invoice Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::attachFileToInvoice",
          "legacyElementId": "JS###v1###QuickBooksOnlineService###attachFileToInvoice",
          "methodName": "attachFileToInvoice",
          "position": {
            "x": 476,
            "y": 810
          }
        },
        "flowElementId": "187981C7-17D2-4CBF-8DF8-589F8F59CA47",
        "groupId": null,
        "id": "910D839B-AFF7-49D5-AE38-9A25AA268BBB",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "invoiceId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice",
                    "subPathSegments": [
                      {
                        "key": "Invoice",
                        "optional": false
                      },
                      {
                        "key": "Id",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "701AD7F7-C691-4C01-B679-38B5C7F6923C"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "POD file",
                    "subPathSegments": [
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8D4EC5FD-0A2B-404C-A7A6-E4191E9CC458"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "POD file",
                    "subPathSegments": [
                      {
                        "key": "filename",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8D4EC5FD-0A2B-404C-A7A6-E4191E9CC458"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "contentType",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "application/pdf"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "note",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "Signed POD for load "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice plan",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D4FF5811-FAA3-41E5-93A4-98411C0B0DC6"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", from McLeod Imaging"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "includeOnSend",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_TRUE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": true
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Attach the POD to the new invoice', 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": "attachFileToInvoice",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "POD on new invoice",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "quickbooks-online",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Attach the POD to the new invoice",
        "nextElementIds": [
          "F77CB43D-96F2-4DB3-8120-FA3B62B153DD"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Queries customers in QuickBooks Online with optional search filtering. Search matches against the DisplayName field. Results are paginated and sorted by DisplayName.",
          "elementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::listCustomers",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the customer in QuickBooks Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::listCustomers",
          "legacyElementId": "JS###v1###QuickBooksOnlineService###listCustomers",
          "methodName": "listCustomers",
          "position": {
            "x": 481,
            "y": 510
          }
        },
        "flowElementId": "E0A92261-9D1F-42CD-82C9-70727C269D04",
        "groupId": null,
        "id": "3EA23AB8-3AAA-4DCC-B8CF-769025DA0F90",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "search",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "McLeod load",
                    "subPathSegments": [
                      {
                        "key": "customer",
                        "optional": false
                      },
                      {
                        "key": "name",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "17A36124-80DE-433C-9637-B51987329551"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "maxResults",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "5"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "startPosition",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Find the customer in QuickBooks', 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": "listCustomers",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "QuickBooks customer",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "quickbooks-online",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the customer in QuickBooks",
        "nextElementIds": [
          "EA117A59-72F8-4B9E-A824-62302377708D"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Queries items in QuickBooks Online with optional filtering by name and type. Results are paginated and sorted by name. Use this to browse your product and service catalog.",
          "elementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::listItems",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the billing items Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::listItems",
          "legacyElementId": "JS###v1###QuickBooksOnlineService###listItems",
          "methodName": "listItems",
          "position": {
            "x": 929,
            "y": 510
          }
        },
        "flowElementId": "092055AB-CD38-4BE1-A6DC-B9681840640A",
        "groupId": null,
        "id": "EA117A59-72F8-4B9E-A824-62302377708D",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "search",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "type",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "maxResults",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "1000"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "startPosition",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Find the billing items', 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": "listItems",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "QuickBooks items",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "quickbooks-online",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the billing items",
        "nextElementIds": [
          "D4FF5811-FAA3-41E5-93A4-98411C0B0DC6"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Write the invoice Result"
          },
          "position": {
            "x": 1325,
            "y": 519
          }
        },
        "flowElementId": "3630921D-894B-4BCE-B441-C16A49F5987E",
        "groupId": null,
        "id": "D4FF5811-FAA3-41E5-93A4-98411C0B0DC6",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "load",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "McLeod load",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "17A36124-80DE-433C-9637-B51987329551"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "invoices",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Load invoices",
                    "subPathSegments": [
                      {
                        "key": "QueryResponse",
                        "optional": false
                      },
                      {
                        "key": "Invoice",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "E95B37EF-6D66-4519-A374-0D1B79FF0385"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "customers",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "QuickBooks customer",
                    "subPathSegments": [
                      {
                        "key": "QueryResponse",
                        "optional": false
                      },
                      {
                        "key": "Customer",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "3EA23AB8-3AAA-4DCC-B8CF-769025DA0F90"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "items",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "QuickBooks items",
                    "subPathSegments": [
                      {
                        "key": "QueryResponse",
                        "optional": false
                      },
                      {
                        "key": "Item",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "EA117A59-72F8-4B9E-A824-62302377708D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "freightItemName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Freight item name",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Freight item name"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "accessorialItemName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Accessorial item name",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Accessorial item name"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const num = (v) => { const n = Number(v); return Number.isFinite(n) ? n : 0; };\nconst cents = (n) => Math.round(num(n) * 100) / 100;\nconst money = (n) => '$' + num(n).toFixed(2);\nconst l = load && typeof load === 'object' ? load : {};\nconst orderId = String(l.orderId || '');\nconst customerName = (l.customer && l.customer.name) || '';\nconst invoiceList = Array.isArray(invoices) ? invoices : [];\nconst existing = invoiceList.find((i) => String(i.DocNumber || '').trim() === orderId);\nconst customerList = Array.isArray(customers) ? customers : [];\nconst customer = customerList.find((c) => String(c.DisplayName || '').trim().toLowerCase() === customerName.trim().toLowerCase()) || customerList[0];\nconst itemList = Array.isArray(items) ? items : [];\nconst findItem = (name) => {\n  const w = String(name || '').trim().toLowerCase();\n  return itemList.find((i) => String(i.Name || '').toLowerCase() === w) || itemList.find((i) => w && String(i.Name || '').toLowerCase().includes(w));\n};\nconst freightItem = findItem(freightItemName);\nconst accessorialItem = findItem(accessorialItemName);\nconst stops = Array.isArray(l.stops) ? l.stops : [];\nconst first = stops[0] || {};\nconst last = stops[stops.length - 1] || {};\nconst lane = first.city && last.city ? `${first.city}, ${first.state} to ${last.city}, ${last.state}` : '';\nconst charges = [];\nif (num(l.freightCharge) !== 0) charges.push({ item: freightItem, description: `Freight, load ${orderId}` + (lane ? `, ${lane}` : ''), amount: cents(l.freightCharge) });\n(Array.isArray(l.accessorials) ? l.accessorials : []).filter((c) => num(c.amount) !== 0).forEach((c) => {\n  charges.push({ item: accessorialItem, description: `${c.description || c.chargeCode || 'Accessorial'}, load ${orderId}`, amount: cents(c.amount), units: num(c.units), rate: num(c.rate) });\n});\nconst total = cents(charges.reduce((s, c) => s + c.amount, 0));\nconst lines = charges.map((c) => {\n  const even = c.units && c.rate && Math.abs(c.units * c.rate - c.amount) < 0.005;\n  return {\n    DetailType: 'SalesItemLineDetail',\n    Amount: c.amount,\n    Description: c.description,\n    SalesItemLineDetail: { ItemRef: { value: c.item ? String(c.item.Id) : '' }, Qty: even ? c.units : 1, UnitPrice: even ? c.rate : c.amount },\n  };\n});\nconst missing = [];\nif (!existing) {\n  if (!customer) missing.push(`${customerName || 'The customer'} is not a customer in QuickBooks Online`);\n  if (!freightItem) missing.push(`no QuickBooks product or service is named \"${freightItemName}\"`);\n  if (!accessorialItem && (Array.isArray(l.accessorials) ? l.accessorials : []).some((c) => num(c.amount) !== 0)) missing.push(`no QuickBooks product or service is named \"${accessorialItemName}\"`);\n  if (!charges.length) missing.push('McLeod has no customer charges on the load');\n}\nconst outcome = existing ? 'attach' : (missing.length ? 'not set up' : 'create');\nreturn {\n  outcome,\n  orderId,\n  customerName,\n  existingInvoiceId: existing ? String(existing.Id) : '',\n  customerId: customer ? String(customer.Id) : '',\n  lines,\n  total,\n  memo: `Load ${orderId}` + (lane ? `, ${lane}` : '') + '. The signed proof of delivery is attached.',\n  note: `Created from McLeod load ${orderId} when it was delivered. Customer charges in McLeod: ${money(l.totalCharge || total)}.`,\n  missingText: `*The invoice for load ${orderId} was not created:* ${missing.join(', and ')}. Set it up in QuickBooks and invoice the load by hand. The signed POD is filed on the load in McLeod.`,\n};\n"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Invoice plan",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Write the invoice",
        "nextElementIds": [
          "23A57DC8-DB52-4DE9-B105-F3A1C5D8CF34"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Lists the documents McLeod Imaging holds for a load (rate confirmation, BOL, POD and the rest): those attached to the order and, unless turned off, those attached to its movements. Each has the ID that Download Document takes.",
          "elementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::listLoadDocuments",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the POD on the load Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::listLoadDocuments",
          "legacyElementId": null,
          "methodName": "listLoadDocuments",
          "position": {
            "x": 915,
            "y": 40
          }
        },
        "flowElementId": "39F427B0-E155-414B-B74D-3E6EA442AB44",
        "groupId": null,
        "id": "61DE685C-5F98-455F-82ED-754967304FF3",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "orderId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "McLeod load",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "17A36124-80DE-433C-9637-B51987329551"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "includeMovementDocuments",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_TRUE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": true
                  }
                ],
                "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": "listLoadDocuments",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Load documents",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "mcleod-loadmaster",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the POD on the load",
        "nextElementIds": [
          "CE5DDC34-A7AF-4D2E-903E-2CC97FBCE645"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Attaches a file, such as a proof of delivery or a signed timesheet, to an existing invoice in QuickBooks Online. The file is downloaded from the given URL (for example a FlowRunner file URL from an earlier step) and uploaded as an attachment linked to the invoice. Turn on Include When Sending to email it with the invoice. Returns the created attachment.",
          "elementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::attachFileToInvoice",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Attach the POD to the existing invoice Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::attachFileToInvoice",
          "legacyElementId": "JS###v1###QuickBooksOnlineService###attachFileToInvoice",
          "methodName": "attachFileToInvoice",
          "position": {
            "x": 870,
            "y": 940
          }
        },
        "flowElementId": "1A6F9641-02F6-4AE5-95F6-7E10AEF71FC4",
        "groupId": null,
        "id": "EDF852C7-2D57-4C50-A736-6FF13B8F0CBD",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "invoiceId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice plan",
                    "subPathSegments": [
                      {
                        "key": "existingInvoiceId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D4FF5811-FAA3-41E5-93A4-98411C0B0DC6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "POD file",
                    "subPathSegments": [
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8D4EC5FD-0A2B-404C-A7A6-E4191E9CC458"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "POD file",
                    "subPathSegments": [
                      {
                        "key": "filename",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8D4EC5FD-0A2B-404C-A7A6-E4191E9CC458"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "contentType",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "application/pdf"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "note",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "Signed POD for load "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice plan",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D4FF5811-FAA3-41E5-93A4-98411C0B0DC6"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ", from McLeod Imaging"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "includeOnSend",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_TRUE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": true
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Attach the POD to the existing invoice', 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": "attachFileToInvoice",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "POD on existing invoice",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "quickbooks-online",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Attach the POD to the existing invoice",
        "nextElementIds": [
          "F77CB43D-96F2-4DB3-8120-FA3B62B153DD"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Creates a new invoice in QuickBooks Online for a specified customer. Line items define the products or services being invoiced. Each line item should include an ItemRef (from the Items dictionary), UnitPrice, and Qty.",
          "elementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::createInvoice",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Create the invoice Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::createInvoice",
          "legacyElementId": "JS###v1###QuickBooksOnlineService###createInvoice",
          "methodName": "createInvoice",
          "position": {
            "x": 930,
            "y": 810
          }
        },
        "flowElementId": "88C83CF8-3B1E-45E3-85DB-73998E6138A3",
        "groupId": null,
        "id": "701AD7F7-C691-4C01-B679-38B5C7F6923C",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "customerId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice plan",
                    "subPathSegments": [
                      {
                        "key": "customerId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D4FF5811-FAA3-41E5-93A4-98411C0B0DC6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "lineItems",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice plan",
                    "subPathSegments": [
                      {
                        "key": "lines",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D4FF5811-FAA3-41E5-93A4-98411C0B0DC6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dueDate",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "txnDate",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "privateNote",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice plan",
                    "subPathSegments": [
                      {
                        "key": "note",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D4FF5811-FAA3-41E5-93A4-98411C0B0DC6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "docNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice plan",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D4FF5811-FAA3-41E5-93A4-98411C0B0DC6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "customerMemo",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice plan",
                    "subPathSegments": [
                      {
                        "key": "memo",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D4FF5811-FAA3-41E5-93A4-98411C0B0DC6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "customFieldId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "customFieldValue",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Create the invoice', 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": "createInvoice",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Invoice",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "quickbooks-online",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Create the invoice",
        "nextElementIds": [
          "910D839B-AFF7-49D5-AE38-9A25AA268BBB"
        ],
        "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,
          "dynamicOptionLabels": {
            "channelId": {}
          },
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Tell billing the invoice is ready Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 110,
            "y": 810
          }
        },
        "flowElementId": "202441BC-3B6D-4A82-9844-2605FEB96A21",
        "groupId": null,
        "id": "F77CB43D-96F2-4DB3-8120-FA3B62B153DD",
        "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": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "*Load "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice plan",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D4FF5811-FAA3-41E5-93A4-98411C0B0DC6"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " for "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice plan",
                    "subPathSegments": [
                      {
                        "key": "customerName",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D4FF5811-FAA3-41E5-93A4-98411C0B0DC6"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " is ready to invoice.* QuickBooks Online invoice "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Invoice plan",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D4FF5811-FAA3-41E5-93A4-98411C0B0DC6"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " has the signed POD attached, and the POD goes out with the invoice when you send it."
                  }
                ],
                "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": "Invoice ready note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell billing the invoice is ready",
        "nextElementIds": [],
        "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,
          "dynamicOptionLabels": {
            "channelId": {}
          },
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Tell billing what's missing Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 912,
            "y": 680
          }
        },
        "flowElementId": "0EEEB45E-8B5E-412B-882D-D9AAF86A0E86",
        "groupId": null,
        "id": "32247D56-131E-4B76-BBD9-7ED46B7F8FF5",
        "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": "Invoice plan",
                    "subPathSegments": [
                      {
                        "key": "missingText",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "D4FF5811-FAA3-41E5-93A4-98411C0B0DC6"
                  }
                ],
                "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": "Missing setup note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell billing what's missing",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1325,
            "y": 219
          }
        },
        "flowElementId": "5EB79705-962E-4CDD-BCE2-9563523B5FFB",
        "groupId": null,
        "id": "95532339-C2F6-453B-B478-F1735EF73916",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "0bccf25a-eb9d-44c8-bc41-216e19878323",
                "nestedOperation": null,
                "operation": "isTrue",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "POD pick",
                      "subPathSegments": [
                        {
                          "key": "found",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "CE5DDC34-A7AF-4D2E-903E-2CC97FBCE645"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "BOOLEAN",
                "values": []
              }
            ],
            "grouping": [
              "0bccf25a-eb9d-44c8-bc41-216e19878323"
            ]
          },
          "elseComponent": {
            "componentId": "0A486F7E-2F8D-4713-A148-54429B7D08C0",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "POD on file",
          "storeResult": false,
          "thenComponent": {
            "componentId": "8D4EC5FD-0A2B-404C-A7A6-E4191E9CC458",
            "componentType": "ELEMENT"
          }
        },
        "name": "POD on file?",
        "nextElementIds": [
          "0A486F7E-2F8D-4713-A148-54429B7D08C0",
          "8D4EC5FD-0A2B-404C-A7A6-E4191E9CC458"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Queries invoices in QuickBooks Online with optional filtering. Search matches against the DocNumber field. Results are paginated and sorted by transaction date in descending order.",
          "elementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::listInvoices",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Look for the load's invoice Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::quickbooks-online:::listInvoices",
          "legacyElementId": "JS###v1###QuickBooksOnlineService###listInvoices",
          "methodName": "listInvoices",
          "position": {
            "x": 503,
            "y": 210
          }
        },
        "flowElementId": "0D3567DB-406C-4A65-ACD5-3DB6AAE73ED1",
        "groupId": null,
        "id": "E95B37EF-6D66-4519-A374-0D1B79FF0385",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "search",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "McLeod load",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "17A36124-80DE-433C-9637-B51987329551"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "maxResults",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "10"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "startPosition",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Look for the load's invoice', 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": "listInvoices",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Load invoices",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "quickbooks-online",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Look for the load's invoice",
        "nextElementIds": [
          "3EA23AB8-3AAA-4DCC-B8CF-769025DA0F90"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      }
    ],
    "firstElementId": "45A9EC7F-5386-41B2-A616-4FD31219E643",
    "groups": [],
    "id": "DA1176CF-6F27-4B0A-B0E7-B44185074545",
    "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": [
        {
          "description": "The McLeod Imaging document type your team files PODs under.",
          "error": null,
          "name": "POD document type",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "The QuickBooks Online product or service for the freight charge.",
          "error": null,
          "name": "Freight item name",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "The QuickBooks Online product or service for accessorial charges such as detention and lumper.",
          "error": null,
          "name": "Accessorial item name",
          "type": "STRING",
          "value": ""
        }
      ],
      "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-26T05:20:55.566Z"
}
