{
  "apiVersion": 64,
  "label": "OpportunityLineItem Recalculate Handler",
  "description": "Companion flow for the RecalculateOLI UI action. The UI action sets Recalculate__c = true and saves the OLI. That save fires the full before-save autocalc chain (Product2 50 -> Currency 60 -> ListPrice 85 -> Expansion 100 -> Discount 150 -> Net Fees 200), which idempotently recomputes ListPrice, Discount, Net_fees__c, etc. from current inputs. This handler then resets Recalculate__c back to false in a follow-up update so the checkbox is ready for the next click.\n\nTrigger: RecordAfterSave, CreateAndUpdate, only fires when Recalculate__c IS TRUE on the saved record. The reset write itself is another update that re-triggers the before-save chain once more (Recalculate__c is then false), then re-fires this after-save handler whose decision now sees Recalculate__c=false and exits without looping. So a single button click costs two cycles of before-save recompute — acceptable for a manual user-triggered action.",
  "status": "Active",
  "processType": "AutoLaunchedFlow",
  "runAtomically": false,
  "start": {
    "locationX": 0,
    "locationY": 0,
    "object": "OpportunityLineItem",
    "triggerType": "RecordAfterSave",
    "recordTriggerType": "CreateAndUpdate",
    "triggerOrder": 250,
    "filterLogic": "and",
    "filters": [
      {
        "field": "Recalculate__c",
        "operator": "EqualTo",
        "value": {
          "booleanValue": true
        }
      }
    ],
    "connector": {
      "targetReference": "Reset_Recalculate_Flag"
    }
  },
  "recordUpdates": [
    {
      "name": "Reset_Recalculate_Flag",
      "label": "Reset Recalculate Flag",
      "locationX": 0,
      "locationY": 0,
      "inputAssignments": [
        {
          "field": "Recalculate__c",
          "value": {
            "booleanValue": false
          }
        }
      ],
      "inputReference": "$Record"
    }
  ]
}
