{
  "apiVersion": 63,
  "status": "Active",
  "label": "Standard Contract Lifecycle Stamp",
  "description": "Keeps Contract lifecycle stamp fields aligned with Status transitions before save.",
  "runAtomically": true,
  "start": {
    "locationX": 40,
    "locationY": 0,
    "object": "Contract",
    "triggerType": "RecordBeforeSave",
    "recordTriggerType": "Update",
    "filterLogic": "1",
    "filters": [
      { "field": "Status", "operator": "IsChanged" }
    ],
    "connector": { "targetReference": "RouteStatusStamp" }
  },
  "decisions": [
    {
      "name": "RouteStatusStamp",
      "label": "Stamp activation or sync status category",
      "locationX": 40,
      "locationY": 120,
      "rules": [
        {
          "name": "StatusActivated",
          "conditionLogic": "and",
          "conditions": [
            { "leftValueReference": "$Record.Status", "operator": "EqualTo", "rightValue": { "stringValue": "Activated" } }
          ],
          "connector": { "targetReference": "StampActivationFields" }
        }
      ],
      "defaultConnector": { "targetReference": "SyncStatusCategory" }
    }
  ],
  "assignments": [
    {
      "name": "StampActivationFields",
      "label": "Stamp Contract activation fields",
      "locationX": 40,
      "locationY": 240,
      "assignmentItems": [
        {
          "assignToReference": "$Record.StatusCode",
          "operator": "Assign",
          "value": { "stringValue": "Activated" }
        },
        {
          "assignToReference": "$Record.ActivatedDate",
          "operator": "Assign",
          "value": { "elementReference": "$Flow.CurrentDateTime" }
        },
        {
          "assignToReference": "$Record.ActivatedById",
          "operator": "Assign",
          "value": { "elementReference": "$User.Id" }
        }
      ]
    },
    {
      "name": "SyncStatusCategory",
      "label": "Sync Contract status category",
      "locationX": 220,
      "locationY": 240,
      "assignmentItems": [
        {
          "assignToReference": "$Record.StatusCode",
          "operator": "Assign",
          "value": { "elementReference": "$Record.Status" }
        }
      ]
    }
  ]
}
