{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "9309F9C8-6E42-44B2-B27F-B94C926BF467",
    "name": "Google Drive: delivered load documents filed"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -70,
        "y": -90,
        "zoom": 1
      },
      "autoSave": false,
      "descriptions": {
        "flow": "When a load is delivered in McLeod, copies the load's documents from McLeod Imaging into its Google Drive folder, named by the load number, creating the folder when needed and skipping documents already filed.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "When a load is delivered in McLeod, copies the load's documents from McLeod Imaging into its Google Drive folder, named by the load number, creating the folder when needed and skipping documents already filed.",
    "elements": [
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Pick documents to copy Result"
          },
          "position": {
            "x": 116,
            "y": 609
          }
        },
        "flowElementId": "03D82A71-1F45-48D2-9A5E-5D94D77EF4D8",
        "groupId": null,
        "id": "AE7878B2-197F-45AD-B2DF-38048BB7A7E0",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "documents",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Load documents",
                    "subPathSegments": [
                      {
                        "key": "documents",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "B93EB070-24F3-4633-8835-3F43FE4CEDF6"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "files",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Filed files",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "D5D3B863-2B48-47D8-ACF0-985F786A030E"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "orderId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Delivered load",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "47E670DC-0AF4-4D79-9AF2-36C8D7DC10BE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const list = v => (Array.isArray(v) ? v : []);\nconst clean = s => String(s || '').replace(/[\\\\/:*?\"<>|]+/g, ' ').replace(/\\s+/g, ' ').trim();\nconst esc = s => String(s).replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n// The type names the emailed paperwork flow uses, so both flows name a load's documents the same way.\nconst typeOf = d => {\n  const code = String(d.documentTypeId || '').trim().toUpperCase();\n  const text = String(d.description || '').toLowerCase();\n  if (code === 'POD' || /proof of delivery|\\bpod\\b/.test(text)) return 'POD';\n  if (code === 'BOL' || /bill of lading|\\bbol\\b/.test(text)) return 'BOL';\n  if (code === 'RATECON' || /rate con/.test(text)) return 'Rate con';\n  if (code === 'INV' || /carrier invoice/.test(text)) return 'Carrier invoice';\n  if (code === 'LUMPER' || /lumper/.test(text)) return 'Lumper receipt';\n  return clean(d.description || d.documentTypeId || 'Document');\n};\nconst names = list(files).map(f => String(f.name || '').trim());\nconst filed = new Set(names.map(n => n.toLowerCase()));\n// Files the emailed paperwork flow filed are named \"<load> <type>.<ext>\". Each one stands for one McLeod document of that type.\nconst emailed = type => names.filter(n => new RegExp(`^${esc(orderId)} ${esc(type)}\\\\.[a-z0-9]+$`, 'i').test(n)).length;\nconst seen = {};\nconst items = [];\nfor (const d of list(documents)) {\n  const type = typeOf(d);\n  const fileName = `${orderId} ${type} ${d.documentId}.pdf`;\n  if (filed.has(fileName.toLowerCase())) continue;\n  seen[type] = (seen[type] || 0) + 1;\n  if (seen[type] <= emailed(type)) continue;\n  items.push({ documentId: String(d.documentId), fileName });\n}\nreturn { items, count: items.length };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "To copy",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Pick documents to copy",
        "nextElementIds": [],
        "nextGroupIds": [
          "0330E938-4C40-4142-9928-BAB926E550A9"
        ],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Load folder ID": "3f4e3936-8f6e-47b3-a34a-9fab6d75aa2e"
          },
          "position": {
            "x": 465,
            "y": 309
          }
        },
        "flowElementId": "FC6C4C2D-6EA9-4769-A175-3D69AF89093B",
        "groupId": null,
        "id": "73972CA8-9A93-4A74-81B6-710056F7DFFD",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "Load folder ID",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "New load folder",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "7813A4F0-BEA2-4ECB-8857-C66DC1CFFA65"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "b2",
          "storeResult": true
        },
        "name": "Use the new folder",
        "nextElementIds": [
          "D5D3B863-2B48-47D8-ACF0-985F786A030E"
        ],
        "nextGroupIds": [],
        "type": "DATA_BUCKET"
      },
      {
        "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": true,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Download it from McLeod Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::downloadDocument",
          "legacyElementId": null,
          "methodName": "downloadDocument",
          "position": {
            "x": 110,
            "y": 40
          }
        },
        "flowElementId": "774E38B3-CC87-4A52-A057-3E689DD4D547",
        "groupId": "0330E938-4C40-4142-9928-BAB926E550A9",
        "id": "5793B21C-6B5B-4167-9802-8827EE1A9039",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "documentId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "documentId",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "0330E938-4C40-4142-9928-BAB926E550A9"
                  }
                ],
                "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": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "fileName",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "0330E938-4C40-4142-9928-BAB926E550A9"
                  }
                ],
                "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": "McLeod file",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "mcleod-loadmaster",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Download it from McLeod",
        "nextElementIds": [
          "097F83AD-9B4E-4A13-AAB3-6D11EA494116"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1109,
            "y": 309
          }
        },
        "flowElementId": "53344CF3-702C-4543-AE59-D8F5DDE7BFFF",
        "groupId": null,
        "id": "73612EDE-C381-473A-B0B2-2F4A7426EDDC",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "d6d5e97b-9d8c-43f9-991f-b3fe695417d2",
                "nestedOperation": null,
                "operation": "isNotEmpty",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Load folder",
                      "subPathSegments": [
                        {
                          "key": "id",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "649C01C8-2E16-468B-9C16-640E505C97EA"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": []
              }
            ],
            "grouping": [
              "d6d5e97b-9d8c-43f9-991f-b3fe695417d2"
            ]
          },
          "elseComponent": {
            "componentId": "7813A4F0-BEA2-4ECB-8857-C66DC1CFFA65",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Load folder there",
          "storeResult": false,
          "thenComponent": {
            "componentId": "662E331F-C36B-416A-9C9B-3D105B6D9081",
            "componentType": "ELEMENT"
          }
        },
        "name": "Load folder there?",
        "nextElementIds": [
          "662E331F-C36B-416A-9C9B-3D105B6D9081",
          "7813A4F0-BEA2-4ECB-8857-C66DC1CFFA65"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "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": 110,
            "y": 130
          }
        },
        "flowElementId": "03D09B18-7BA5-4848-80A5-A759EAF80C10",
        "groupId": null,
        "id": "47E670DC-0AF4-4D79-9AF2-36C8D7DC10BE",
        "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": [
          "B93EB070-24F3-4633-8835-3F43FE4CEDF6"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 783,
            "y": 139
          }
        },
        "flowElementId": "ABE7971B-3EDA-49E9-AADC-54FDF8B35202",
        "groupId": null,
        "id": "E9FEAC64-9468-4B2B-ACBC-0829B24D450C",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "201e357c-4e6e-4295-9a32-439f332dbb43",
                "nestedOperation": null,
                "operation": ">",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Load documents",
                      "subPathSegments": [
                        {
                          "key": "count",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "B93EB070-24F3-4633-8835-3F43FE4CEDF6"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "INT",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "NUMBER",
                        "label": null,
                        "type": "INPUT",
                        "value": 0
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "201e357c-4e6e-4295-9a32-439f332dbb43"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Documents on the load",
          "storeResult": false,
          "thenComponent": {
            "componentId": "649C01C8-2E16-468B-9C16-640E505C97EA",
            "componentType": "ELEMENT"
          }
        },
        "name": "Documents on the load?",
        "nextElementIds": [
          "649C01C8-2E16-468B-9C16-640E505C97EA"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Retrieves a complete list of files from a Google Drive folder for AI agents to process directory contents, analyze file structures, or manage collections of documents. Perfect for automated workflows that need to iterate through files, generate reports on folder contents, or process multiple files in batch operations.",
          "elementId": "EXTENSION:::SHARED:::default:::google-drive-api:::getFolderListing",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "List what's already filed Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::google-drive-api:::getFolderListing",
          "legacyElementId": "JS###v1###GoogleDrive###getFolderListing",
          "methodName": "getFolderListing",
          "position": {
            "x": 117,
            "y": 300
          }
        },
        "flowElementId": "5599A51A-6E90-4C22-9390-2F9393F5D27C",
        "groupId": null,
        "id": "D5D3B863-2B48-47D8-ACF0-985F786A030E",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "sharedDriveId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "folderId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Load folder ID",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Load folder ID",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Load folder ID",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileFilter",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "recurringRetrieval",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "verboseResponse",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'List what's already filed', 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": "getFolderListing",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Filed files",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "google-drive-api",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "List what's already filed",
        "nextElementIds": [
          "AE7878B2-197F-45AD-B2DF-38048BB7A7E0"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Downloads files from URLs and uploads them to Google Drive, enabling AI agents to archive web content, save API responses, or collect files from external sources. Perfect for automated workflows that need to backup files from other services or capture generated content.",
          "elementId": "EXTENSION:::SHARED:::default:::google-drive-api:::uploadFile",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Copy it to the load folder Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::google-drive-api:::uploadFile",
          "legacyElementId": "JS###v1###GoogleDrive###uploadFile",
          "methodName": "uploadFile",
          "position": {
            "x": 446,
            "y": 40
          }
        },
        "flowElementId": "6FBE6329-332C-4C79-87C4-9ED9F3A24920",
        "groupId": "0330E938-4C40-4142-9928-BAB926E550A9",
        "id": "097F83AD-9B4E-4A13-AAB3-6D11EA494116",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "sharedDriveId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "folderId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Load folder ID",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Load folder ID",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Load folder ID",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "name",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "fileName",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "0330E938-4C40-4142-9928-BAB926E550A9"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fileUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "McLeod file",
                    "subPathSegments": [
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5793B21C-6B5B-4167-9802-8827EE1A9039"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Copy it to the load folder', 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": "uploadFile",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Copied document",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "google-drive-api",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Copy it to the load folder",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Load folder ID": "0f38d372-800c-4c44-83ba-e36ca1d333b6"
          },
          "position": {
            "x": 796,
            "y": 439
          }
        },
        "flowElementId": "2C846C09-242E-42D9-9878-6B3FDE0DAE26",
        "groupId": null,
        "id": "662E331F-C36B-416A-9C9B-3D105B6D9081",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "Load folder ID",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Load folder",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "649C01C8-2E16-468B-9C16-640E505C97EA"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "b1",
          "storeResult": true
        },
        "name": "Use the load folder",
        "nextElementIds": [
          "D5D3B863-2B48-47D8-ACF0-985F786A030E"
        ],
        "nextGroupIds": [],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "notes": "Creates a new folder in Google Drive.",
          "elementId": "EXTENSION:::SHARED:::default:::google-drive-api:::createFolder",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Create the load folder Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::google-drive-api:::createFolder",
          "legacyElementId": "JS###v1###GoogleDrive###createFolder",
          "methodName": "createFolder",
          "position": {
            "x": 791,
            "y": 300
          }
        },
        "flowElementId": "783F90D9-CFD8-4C7E-B925-B9EF9E003F9F",
        "groupId": null,
        "id": "7813A4F0-BEA2-4ECB-8857-C66DC1CFFA65",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "sharedDriveId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "parentFolderId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Loads folder",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Loads folder"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "name",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Delivered load",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "47E670DC-0AF4-4D79-9AF2-36C8D7DC10BE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Create the load folder', Error: The placeholder \"Loads folder\" has no value",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "createFolder",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "New load folder",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "google-drive-api",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Create the load folder",
        "nextElementIds": [
          "73972CA8-9A93-4A74-81B6-710056F7DFFD"
        ],
        "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": "List the load's documents Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::listLoadDocuments",
          "legacyElementId": null,
          "methodName": "listLoadDocuments",
          "position": {
            "x": 446,
            "y": 130
          }
        },
        "flowElementId": "0485C927-63A4-440A-8468-B30BA963D1DF",
        "groupId": null,
        "id": "B93EB070-24F3-4633-8835-3F43FE4CEDF6",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "orderId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Delivered load",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "47E670DC-0AF4-4D79-9AF2-36C8D7DC10BE"
                  }
                ],
                "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": "List the load's documents",
        "nextElementIds": [
          "E9FEAC64-9468-4B2B-ACBC-0829B24D450C"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Locates folders in Google Drive for AI agents to find target directories, verify folder existence, or get folder information for file organization workflows. Perfect for automated systems that need to find specific folders before performing file operations.",
          "elementId": "EXTENSION:::SHARED:::default:::google-drive-api:::findFolder",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the load folder Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::google-drive-api:::findFolder",
          "legacyElementId": "JS###v1###GoogleDrive###findFolder",
          "methodName": "findFolder",
          "position": {
            "x": 1109,
            "y": 130
          }
        },
        "flowElementId": "2D6D489A-3EF3-4CCC-AC7B-6E05A0FF1AC0",
        "groupId": null,
        "id": "649C01C8-2E16-468B-9C16-640E505C97EA",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "toSharedDriveId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "search",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Delivered load",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "47E670DC-0AF4-4D79-9AF2-36C8D7DC10BE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "parentFolderId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Loads folder",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Loads folder"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "exactMatch",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_TRUE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": true
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Find the load folder', Error: The placeholder \"Loads folder\" has no value",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "findFolder",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Load folder",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "google-drive-api",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the load folder",
        "nextElementIds": [
          "73612EDE-C381-473A-B0B2-2F4A7426EDDC"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      }
    ],
    "firstElementId": "47E670DC-0AF4-4D79-9AF2-36C8D7DC10BE",
    "groups": [
      {
        "clientMetadata": {
          "elementId": "list-iterator",
          "isFirstElement": false,
          "blockDefinitionId": "list-iterator",
          "viewport": {
            "x": -70,
            "y": 0,
            "zoom": 1
          },
          "position": {
            "x": 452,
            "y": 609
          }
        },
        "flowElementId": "E6648415-F0CF-4C7C-BC86-ABB646E5E8C9",
        "groupId": null,
        "id": "0330E938-4C40-4142-9928-BAB926E550A9",
        "loopType": "LIST_ITERATOR",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'For each new document', Error: Children have error",
            "valid": false
          },
          "enabled": true,
          "firstElementId": "5793B21C-6B5B-4167-9802-8827EE1A9039",
          "list": {
            "expression": [
              {
                "id": "ELEMENT_RESULT",
                "label": "To copy",
                "subPathSegments": [
                  {
                    "key": "items",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "AE7878B2-197F-45AD-B2DF-38048BB7A7E0"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "onFailElemId": null,
          "resultAlias": "L",
          "storeResult": true
        },
        "name": "For each new document",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "LOOP"
      }
    ],
    "id": "AA180456-CE95-485E-9315-178F8C68E251",
    "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 ID of the Google Drive folder that holds one folder per load (the part of the folder's link after /folders/).",
          "error": null,
          "name": "Loads folder",
          "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:49:20.624Z"
}
