{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "ADA7EA4F-C28E-4376-ACEA-CA5788CADA33",
    "name": "Microsoft Teams: detention past free time approved"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -65.11945392491468,
        "y": 1.774744027303754,
        "zoom": 0.96
      },
      "autoSave": false,
      "descriptions": {
        "flow": "When a McLeod load delivers, compares each stop's actual arrival and departure with free time. Detention past free time goes to the ops manager in Teams on an Adaptive Card; on approval, carrier extra pay and the customer detention charge are added to the load in McLeod.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "When a McLeod load delivers, compares each stop's actual arrival and departure with free time. Detention past free time goes to the ops manager in Teams on an Adaptive Card; on approval, carrier extra pay and the customer detention charge are added to the load in McLeod.",
    "elements": [
      {
        "clientMetadata": {
          "notes": "Posts an Adaptive Card to a team channel as the signed-in user, with optional text above it and an optional subject line. Use it for actionable notices such as an invoice exception card with Approve and Dispute buttons. Buttons must be Action.OpenUrl: Microsoft Graph supports only that action on a card a user posts, and other actions need a bot. Uses the same ChannelMessage.Send permission as Send Channel Message.",
          "elementId": "EXTENSION:::SHARED:::default:::microsoft-teams:::sendAdaptiveCardToChannel",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Ask the ops manager Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::microsoft-teams:::sendAdaptiveCardToChannel",
          "legacyElementId": "JS###v1###MicrosoftTeamsService###sendAdaptiveCardToChannel",
          "methodName": "sendAdaptiveCardToChannel",
          "position": {
            "x": 1276,
            "y": 340
          }
        },
        "flowElementId": "53F1405D-571F-489B-BDD5-38A38E784666",
        "groupId": null,
        "id": "788A3227-B31E-4E7F-8018-28C182269903",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "teamId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Teams team ID",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Teams team ID"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Teams channel ID",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Teams channel ID"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "card",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Detention",
                    "subPathSegments": [
                      {
                        "key": "card",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "text",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "subject",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Detention",
                    "subPathSegments": [
                      {
                        "key": "subject",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Ask the ops manager', Error: The placeholder \"Teams team ID\" has no value",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "sendAdaptiveCardToChannel",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Ops card",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "microsoft-teams",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Ask the ops manager",
        "nextElementIds": [
          "85A1766D-FF37-4ED3-95A7-01F1A3188E31"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Applies a changed tender to an existing load (McLeod order): only the inputs you fill in change. Stops are matched by position in route order: the first entry changes the first stop, fields left empty keep their value, and entries past the load's last stop add stops (stops are never removed). An accessorial charge replaces the load's charge with the same charge code or is added; other charges stay. Stop reference numbers are added unless the stop already has them. McLeod applies its usual validation. Returns the load as Get Load does.",
          "elementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::updateLoad",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Bill the customer detention Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::updateLoad",
          "legacyElementId": null,
          "methodName": "updateLoad",
          "position": {
            "x": 124,
            "y": 510
          }
        },
        "flowElementId": "F71BC72D-3B56-46F1-AB0F-9C49F10DE87E",
        "groupId": null,
        "id": "2D535FAD-8E87-4606-A110-479B6408AEAA",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "orderId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Detention",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "stops",
              "type": "COMPLEX_LIST",
              "value": []
            },
            {
              "name": "shipmentId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "billOfLading",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "poNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "consigneeReference",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "pieces",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "weight",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "weightUnit",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "commodity",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "equipmentTypeId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "freightCharge",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "rate",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "rateType",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "rateUnits",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "accessorialCharges",
              "type": "COMPLEX_LIST",
              "value": [
                {
                  "type": "OBJECT",
                  "value": [
                    {
                      "name": "chargeCode",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "ELEMENT_RESULT",
                            "label": "Detention",
                            "subPathSegments": [
                              {
                                "key": "chargeCode",
                                "optional": false
                              }
                            ],
                            "type": "ELEMENT_LINK",
                            "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "description",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "ELEMENT_RESULT",
                            "label": "Detention",
                            "subPathSegments": [
                              {
                                "key": "description",
                                "optional": false
                              }
                            ],
                            "type": "ELEMENT_LINK",
                            "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "units",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "ELEMENT_RESULT",
                            "label": "Detention",
                            "subPathSegments": [
                              {
                                "key": "hours",
                                "optional": false
                              }
                            ],
                            "type": "ELEMENT_LINK",
                            "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "rate",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "ELEMENT_RESULT",
                            "label": "Detention",
                            "subPathSegments": [
                              {
                                "key": "customerRate",
                                "optional": false
                              }
                            ],
                            "type": "ELEMENT_LINK",
                            "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    },
                    {
                      "name": "amount",
                      "type": "SIMPLE",
                      "value": {
                        "expression": [
                          {
                            "id": "ELEMENT_RESULT",
                            "label": "Detention",
                            "subPathSegments": [
                              {
                                "key": "customerAmount",
                                "optional": false
                              }
                            ],
                            "type": "ELEMENT_LINK",
                            "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                          }
                        ],
                        "mode": "EXPRESSION",
                        "parseJsonString": false,
                        "resultType": null
                      }
                    }
                  ]
                }
              ]
            },
            {
              "name": "stopReferenceNumbers",
              "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": "updateLoad",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Updated load",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "mcleod-loadmaster",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Bill the customer detention",
        "nextElementIds": [
          "34E849C3-2EFF-424D-8093-FD740CB4B8BE"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Sends a reply to an existing message in a team channel as the signed-in user. Supports plain text or HTML content.",
          "elementId": "EXTENSION:::SHARED:::default:::microsoft-teams:::replyToChannelMessage",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Confirm in the Teams thread Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::microsoft-teams:::replyToChannelMessage",
          "legacyElementId": "JS###v1###MicrosoftTeamsService###replyToChannelMessage",
          "methodName": "replyToChannelMessage",
          "position": {
            "x": 496,
            "y": 510
          }
        },
        "flowElementId": "1D4BA860-60C9-4558-85EA-AF0CD72DD363",
        "groupId": null,
        "id": "34E849C3-2EFF-424D-8093-FD740CB4B8BE",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "teamId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Teams team ID",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Teams team ID"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Teams channel ID",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Teams channel ID"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ops card",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "788A3227-B31E-4E7F-8018-28C182269903"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "contentType",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "text"
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "content",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Detention",
                    "subPathSegments": [
                      {
                        "key": "confirmText",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Confirm in the Teams thread', Error: The placeholder \"Teams team ID\" has no value",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "replyToChannelMessage",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Confirmation",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "microsoft-teams",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Confirm in the Teams thread",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Work out detention at each stop Result"
          },
          "position": {
            "x": 872,
            "y": 49
          }
        },
        "flowElementId": "5294E6EE-7D41-4326-B080-119571DC89DD",
        "groupId": null,
        "id": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'Work out detention at each stop', Error: The placeholder \"Customer detention rate per hour\" has no value",
            "valid": false
          },
          "codeArguments": [
            {
              "name": "loaded",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Load",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "D6BFA53A-A5C4-4BDF-86A6-D9322B0F5B01"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "freeHours",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Free time hours",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Free time hours"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "customerRate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Customer detention rate per hour",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Customer detention rate per hour"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "carrierRate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Carrier detention rate per hour",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Carrier detention rate per hour"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "chargeCode",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Detention charge code",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Detention charge code"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "payCode",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Detention pay code",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Detention pay code"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "answerLink",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Answer link",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Answer link"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "executionId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_ID",
                    "label": null,
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.executionId",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "executionId",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const load = loaded && typeof loaded === 'object' ? loaded : {};\nconst num = (v) => { const n = Number(v); return Number.isFinite(n) ? n : 0; };\nconst usd = (n) => '$' + num(n).toFixed(2);\nconst round2 = (n) => Math.round(num(n) * 100) / 100;\n// Stop times are compared as the local wall-clock time McLeod shows for that stop\nconst wall = (iso) => { const m = /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2})/.exec(String(iso || '')); return m ? Date.UTC(+m[1], +m[2] - 1, +m[3], +m[4], +m[5]) : null; };\nconst fmt = (t) => (t == null ? 'not recorded' : new Date(t).toISOString().slice(0, 16).replace('T', ' '));\n\nconst stops = Array.isArray(load.stops) ? load.stops : [];\nconst moves = Array.isArray(load.movements) ? load.movements : [];\nconst movement = moves.find((m) => String(m.movementId) === String(load.currentMovementId)) || moves[moves.length - 1] || {};\nconst carrierName = (movement.carrier && movement.carrier.name) || (load.carrier && load.carrier.name) || 'No carrier in McLeod';\nconst customerName = (load.customer && load.customer.name) || 'Not shown';\nconst orderId = String(load.orderId || '');\nconst free = num(freeHours);\nconst custRate = num(customerRate);\nconst carRate = num(carrierRate);\n\nlet hours = 0;\nconst facts = [];\nconst counted = [];\nfor (const s of stops) {\n  const where = `${s.stopTypeDescription || s.stopType || 'Stop'} ${s.sequence || ''}, ${[s.locationName, s.city].filter(Boolean).join(', ') || 'no location'}`.replace(/\\s+,/, ',');\n  const arr = wall(s.actualArrival);\n  const dep = wall(s.actualDeparture);\n  const opens = wall(s.scheduledArriveEarly);\n  const closes = wall(s.scheduledArriveLate);\n  if (arr == null || dep == null) { facts.push({ title: where, value: 'No arrival or departure in McLeod. Not counted.' }); continue; }\n  if (closes != null && arr > closes) { facts.push({ title: where, value: `Arrived ${fmt(arr)}, after the window closed at ${fmt(closes)}. Not counted.` }); continue; }\n  const start = opens != null && opens > arr ? opens : arr;\n  const onSite = Math.max(0, (dep - start) / 36e5);\n  const billable = Math.ceil(Math.max(0, onSite - free) * 4) / 4;\n  hours += billable;\n  if (billable > 0) counted.push(`${where}: ${billable} h`);\n  facts.push({ title: where, value: `Window opens ${fmt(opens)}. Arrived ${fmt(arr)}, departed ${fmt(dep)}. ${onSite.toFixed(2)} h on site, ${billable} h past free time.` });\n}\n\nconst code = String(chargeCode || '').toUpperCase();\nconst pcode = String(payCode || '').toUpperCase();\nconst extraPay = Array.isArray(movement.extraPay) && movement.extraPay.length ? movement.extraPay : (Array.isArray(load.carrierExtraPay) ? load.carrierExtraPay : []);\nconst existingCharge = (Array.isArray(load.accessorials) ? load.accessorials : []).find((a) => String(a.chargeCode || '').toUpperCase() === code);\nconst existingPay = extraPay.find((e) => String(e.deductCodeId || '').toUpperCase() === pcode);\nconst outcome = hours > 0 && !existingCharge && !existingPay ? 'ask' : 'none';\n\nconst customerAmount = round2(hours * custRate);\nconst carrierAmount = round2(hours * carRate);\nconst link = (decision) => `${answerLink}?execution=${encodeURIComponent(executionId)}&decision=${decision}`;\nconst subject = `Detention on load ${orderId}`;\nconst card = {\n  type: 'AdaptiveCard',\n  $schema: 'http://adaptivecards.io/schemas/adaptive-card.json',\n  version: '1.4',\n  body: [\n    { type: 'TextBlock', text: `Load ${orderId} delivered with ${hours} hours of detention past free time`, weight: 'Bolder', size: 'Medium', wrap: true },\n    { type: 'FactSet', facts: [\n      { title: 'Customer', value: customerName },\n      { title: 'Carrier', value: carrierName },\n      { title: 'Free time', value: `${free} hours at each stop` },\n      { title: 'Bill the customer', value: `${hours} h at ${usd(custRate)} = ${usd(customerAmount)}` },\n      { title: 'Pay the carrier', value: `${hours} h at ${usd(carRate)} = ${usd(carrierAmount)}` },\n    ] },\n    { type: 'TextBlock', text: 'Stop times in McLeod', weight: 'Bolder', spacing: 'Medium', wrap: true },\n    { type: 'FactSet', facts },\n    { type: 'TextBlock', text: 'The clock starts when the appointment window opens if the truck was early. A truck that arrived after its window gets no detention at that stop.', isSubtle: true, wrap: true },\n  ],\n  actions: [\n    { type: 'Action.OpenUrl', title: 'Add detention', url: link('add') },\n    { type: 'Action.OpenUrl', title: 'No detention', url: link('skip') },\n  ],\n};\n\nreturn {\n  outcome,\n  orderId,\n  movementId: String(movement.movementId || load.currentMovementId || ''),\n  hours,\n  customerRate: custRate,\n  customerAmount,\n  carrierRate: carRate,\n  carrierAmount,\n  chargeCode,\n  payCode,\n  description: `Detention, ${counted.join('; ')}`.slice(0, 60),\n  subject,\n  card,\n  confirmText: `Added to load ${orderId} in McLeod: carrier extra pay ${pcode} ${usd(carrierAmount)} for ${carrierName}, and customer charge ${code} ${usd(customerAmount)} for ${customerName} (${hours} hours).`,\n  skipText: `No detention added to load ${orderId}. McLeod is unchanged.`,\n};\n"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Detention",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Work out detention at each stop",
        "nextElementIds": [
          "9B44A1E3-2FD6-4852-B484-631FC8338678"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 523,
            "y": 349
          }
        },
        "flowElementId": "0263ECED-13D8-4AFB-80AA-8878120B8785",
        "groupId": null,
        "id": "6B8C0880-F974-4286-8C3A-76FDB930D24C",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "ee8a3a6f-0b0b-4be7-b60e-9ccc8727ba6d",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "RESULT",
                      "label": "Ops decision",
                      "subPathSegments": [
                        {
                          "key": "decision",
                          "optional": false
                        }
                      ],
                      "type": "TRIGGER_DATA",
                      "value": "85A1766D-FF37-4ED3-95A7-01F1A3188E31"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "add"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "ee8a3a6f-0b0b-4be7-b60e-9ccc8727ba6d"
            ]
          },
          "elseComponent": {
            "componentId": "55F6E0D5-426B-4CB2-A048-287F1AD835EB",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Add detention",
          "storeResult": false,
          "thenComponent": {
            "componentId": "102D6ED2-6F9B-47A7-99D0-C679A773A419",
            "componentType": "ELEMENT"
          }
        },
        "name": "Add the detention?",
        "nextElementIds": [
          "102D6ED2-6F9B-47A7-99D0-C679A773A419",
          "55F6E0D5-426B-4CB2-A048-287F1AD835EB"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Adds extra pay owed to the carrier on a load (McLeod other pay on the movement), such as detention, layover or a lumper the carrier paid. Paid to the movement's carrier unless another payee is given. McLeod applies its usual validation; the movement's extra pay is read before and after, and the action fails if no new entry appears. Returns the new entry and all of the movement's extra pay.",
          "elementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::addCarrierExtraPay",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Pay the carrier detention Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::addCarrierExtraPay",
          "legacyElementId": null,
          "methodName": "addCarrierExtraPay",
          "position": {
            "x": 132,
            "y": 340
          }
        },
        "flowElementId": "675E23B8-4582-4D37-98CA-C5F7B6C7ED11",
        "groupId": null,
        "id": "102D6ED2-6F9B-47A7-99D0-C679A773A419",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "orderId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Detention",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "movementId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Detention",
                    "subPathSegments": [
                      {
                        "key": "movementId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "payCode",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Detention",
                    "subPathSegments": [
                      {
                        "key": "payCode",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "amount",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Detention",
                    "subPathSegments": [
                      {
                        "key": "carrierAmount",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "units",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Detention",
                    "subPathSegments": [
                      {
                        "key": "hours",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "rate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Detention",
                    "subPathSegments": [
                      {
                        "key": "carrierRate",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "description",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Detention",
                    "subPathSegments": [
                      {
                        "key": "description",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "payeeId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "addCarrierExtraPay",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Carrier extra pay",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "mcleod-loadmaster",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Pay the carrier detention",
        "nextElementIds": [
          "2D535FAD-8E87-4606-A110-479B6408AEAA"
        ],
        "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": 129,
            "y": 40
          }
        },
        "flowElementId": "18CD1D79-11C0-4CD1-BB91-36D8479B627C",
        "groupId": null,
        "id": "556A7723-8C04-4DD5-91D9-741F2B49A155",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": null,
          "connectionId": null,
          "dynamicData": [],
          "eventName": "onLoadStatusChanged",
          "frequency": {
            "repeat": {
              "every": 300
            },
            "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": [
          "D6BFA53A-A5C4-4BDF-86A6-D9322B0F5B01"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "notes": "Gets one load (McLeod order) by its order ID: status, customer, the user who entered it, 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 carrier rep (the movement's dispatcher), the agreed carrier pay and the carrier extra pay, plus the full McLeod records. Optionally adds the customer's contacts and billing contact email.",
          "elementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::getLoad",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Get the stop times from McLeod Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::mcleod-loadmaster:::getLoad",
          "legacyElementId": null,
          "methodName": "getLoad",
          "position": {
            "x": 483,
            "y": 40
          }
        },
        "flowElementId": "BC592099-6683-4901-82CE-F69EC08FCC69",
        "groupId": null,
        "id": "D6BFA53A-A5C4-4BDF-86A6-D9322B0F5B01",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "orderId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Delivered load",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "556A7723-8C04-4DD5-91D9-741F2B49A155"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "includeCustomerContacts",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "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": "Load",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "mcleod-loadmaster",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Get the stop times from McLeod",
        "nextElementIds": [
          "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "external-callback",
          "isFirstElement": false,
          "blockDefinitionId": "external-callback",
          "position": {
            "x": 863,
            "y": 349
          }
        },
        "flowElementId": "D68ED825-FCF4-407A-9090-3876E6217CD0",
        "groupId": null,
        "id": "85A1766D-FF37-4ED3-95A7-01F1A3188E31",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": null,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "resultAlias": "Ops decision",
          "slaConditions": [],
          "storeResult": true,
          "type": "CALLBACK"
        },
        "name": "Wait for the ops manager's answer",
        "nextElementIds": [
          "6B8C0880-F974-4286-8C3A-76FDB930D24C"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1261,
            "y": 49
          }
        },
        "flowElementId": "9704AA59-A99D-4989-88BE-975BA439B621",
        "groupId": null,
        "id": "9B44A1E3-2FD6-4852-B484-631FC8338678",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "c9e1f547-09d3-49d4-b21d-259de84b9915",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Detention",
                      "subPathSegments": [
                        {
                          "key": "outcome",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "STRING",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "ask"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "c9e1f547-09d3-49d4-b21d-259de84b9915"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Detention owed",
          "storeResult": false,
          "thenComponent": {
            "componentId": "788A3227-B31E-4E7F-8018-28C182269903",
            "componentType": "ELEMENT"
          }
        },
        "name": "Detention past free time?",
        "nextElementIds": [
          "788A3227-B31E-4E7F-8018-28C182269903"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Sends a reply to an existing message in a team channel as the signed-in user. Supports plain text or HTML content.",
          "elementId": "EXTENSION:::SHARED:::default:::microsoft-teams:::replyToChannelMessage",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Note no detention in the thread Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::microsoft-teams:::replyToChannelMessage",
          "legacyElementId": "JS###v1###MicrosoftTeamsService###replyToChannelMessage",
          "methodName": "replyToChannelMessage",
          "position": {
            "x": 110,
            "y": 210
          }
        },
        "flowElementId": "011D30C1-2180-456F-BAA8-103ADE5D1A2B",
        "groupId": null,
        "id": "55F6E0D5-426B-4CB2-A048-287F1AD835EB",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "teamId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Teams team ID",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Teams team ID"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Teams channel ID",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Teams channel ID"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ops card",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "788A3227-B31E-4E7F-8018-28C182269903"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "contentType",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "text"
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "content",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Detention",
                    "subPathSegments": [
                      {
                        "key": "skipText",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "CB289A56-6C76-4D8E-9CE3-9B6A1445FC9F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Note no detention in the thread', Error: The placeholder \"Teams team ID\" has no value",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "replyToChannelMessage",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "No detention note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "microsoft-teams",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Note no detention in the thread",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      }
    ],
    "firstElementId": "556A7723-8C04-4DD5-91D9-741F2B49A155",
    "groups": [],
    "id": "E5D60AB9-CC30-455C-A047-C0003C58B050",
    "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": "Block 'Work out detention at each stop' has an invalid configuration. Code Argument 'customerRate' has invalid value. Placeholder Data 'Customer detention rate per hour': value is required",
      "executionStaticData": [
        {
          "description": "The URL of the block Wait for the ops manager's answer. The Teams card buttons open it.",
          "error": null,
          "name": "Answer link",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "The ID of the Microsoft Teams team that holds the ops channel (groupId in the channel's link).",
          "error": null,
          "name": "Teams team ID",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "The ID of the ops channel, 19:...@thread.tacv2 (in the channel's link).",
          "error": null,
          "name": "Teams channel ID",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "Free hours at each stop before detention starts.",
          "error": null,
          "name": "Free time hours",
          "type": "DOUBLE",
          "value": ""
        },
        {
          "description": "What the customer is billed per hour of detention.",
          "error": "Placeholder Data 'Customer detention rate per hour': value is required",
          "name": "Customer detention rate per hour",
          "type": "DOUBLE",
          "value": ""
        },
        {
          "description": "What the carrier is paid per hour of detention.",
          "error": null,
          "name": "Carrier detention rate per hour",
          "type": "DOUBLE",
          "value": ""
        },
        {
          "description": "The McLeod other charge code for detention billed to the customer.",
          "error": null,
          "name": "Detention charge code",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "The McLeod pay code for detention paid to the carrier.",
          "error": null,
          "name": "Detention pay code",
          "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-29T02:51:06.691Z"
}
