{
  "apiVersion": 63,
  "status": "Active",
  "label": "Standard Dated Conversion Rate Close On Append",
  "description": "Enforces the Salesforce 'Manage Dated Exchange Rates' invariant: after a create commits, every other period of the same currency strictly covering the new StartDate (StartDate < S < NextStartDate) is truncated to end at S, so half-open [StartDate, NextStartDate) periods stay non-overlapping. Three deliberate constraints: the StartDate comparison is strict because equal-start rows are rejected pre-save by Std_DatedConversionRateDefaultNextStart, and closing them here would let two same-instant creates truncate each other into empty periods; the trigger is RecordAfterSave because a before-save flow can only assign to $Record; and runAtomically is absent because the platform's install-time check rejects it on after-save. The truncation is therefore asynchronous and at-least-once — readers must prefer the newest StartDate, and the next append re-truncates every still-covering row.",
  "start": {
    "locationX": 40,
    "locationY": 0,
    "object": "DatedConversionRate",
    "triggerType": "RecordAfterSave",
    "recordTriggerType": "Create",
    "connector": {
      "targetReference": "CloseOverlappingPeriods"
    }
  },
  "recordUpdates": [
    {
      "name": "CloseOverlappingPeriods",
      "label": "Close overlapping periods for currency",
      "locationX": 40,
      "locationY": 120,
      "object": "DatedConversionRate",
      "filterLogic": "and",
      "filters": [
        {
          "field": "IsoCode",
          "operator": "EqualTo",
          "value": {
            "elementReference": "$Record.IsoCode"
          }
        },
        {
          "field": "Id",
          "operator": "NotEqualTo",
          "value": {
            "elementReference": "$Record.Id"
          }
        },
        {
          "field": "StartDate",
          "operator": "LessThan",
          "value": {
            "elementReference": "$Record.StartDate"
          }
        },
        {
          "field": "NextStartDate",
          "operator": "GreaterThan",
          "value": {
            "elementReference": "$Record.StartDate"
          }
        }
      ],
      "inputAssignments": [
        {
          "field": "NextStartDate",
          "value": {
            "elementReference": "$Record.StartDate"
          }
        }
      ]
    }
  ]
}
