{
  "apiVersion": 56,
  "label": "Credits — Notify Regional Ops on Final Approval",
  "description": "Approval-notification Flow (proposal §0 Phase 3 item 2 — the regional-ops use case that motivated upstream NX#930/PR#3627). Invoked ONLY by the approval lifecycle bridge via ProcessAction ActionType='Flow' rows bound to the FinalApproval event of both Credits chains; no record trigger by design. Recipient = $Record.Regional_Ops_User__c, the regional operations owner stamped at Create from Region_All__c.Region_Ops__c (pack PR #3889) — a stamped third-party recipient, NOT an approval-context variable, so this Flow works without any scaffold recipient-kind support. The ops owner then performs the credit reset/provisioning in the external billing system. A guard Decision ends the Flow silently when the field is blank (ops coverage is per-region data; a missing owner must not surface a ProcessActionFailure — mirrors the field's non-NeedsTriage contract). Dual channel: email via resolveEmailRecipients + sendEmail (template emailtmpl_credits_ops_reset_20260713, seeded by credits-approvals.seed.json) and one in-app bell notification via sendNotification. Requires the sendNotification actionCall (upstream NX PR#3627, nexuscrm >= 6f611b75) — do not bind before the stack ref bump.",
  "processType": "AutoLaunchedFlow",
  "status": "Active",
  "start": {
    "connector": {
      "targetReference": "Check_Ops_Present"
    },
    "locationX": 0,
    "locationY": -120
  },
  "variables": [
    {
      "name": "ApprovalEmail_To_Recipients",
      "dataType": "String",
      "isCollection": true
    }
  ],
  "decisions": [
    {
      "name": "Check_Ops_Present",
      "label": "Regional Ops stamped?",
      "locationX": 0,
      "locationY": 0,
      "rules": [
        {
          "name": "ops_present",
          "conditionLogic": "and",
          "conditions": [
            {
              "leftValueReference": "$Record.Regional_Ops_User__c",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": false
              }
            }
          ],
          "connector": {
            "targetReference": "Resolve_To_Recipients"
          }
        }
      ]
    }
  ],
  "actionCalls": [
    {
      "name": "Resolve_To_Recipients",
      "label": "Resolve Regional Ops Email",
      "locationX": 0,
      "locationY": 120,
      "actionName": "resolveEmailRecipients",
      "actionType": "resolveEmailRecipients",
      "inputParameters": [
        {
          "name": "userIds",
          "value": {
            "elementReference": "$Record.Regional_Ops_User__c"
          }
        }
      ],
      "outputParameters": [
        {
          "name": "emails",
          "value": "ApprovalEmail_To_Recipients"
        }
      ],
      "connector": {
        "targetReference": "Send_Email_Notification"
      }
    },
    {
      "name": "Send_Email_Notification",
      "label": "Email Regional Ops (Reset Required)",
      "locationX": 0,
      "locationY": 240,
      "actionName": "sendEmail",
      "actionType": "sendEmail",
      "inputParameters": [
        {
          "name": "templateId",
          "value": {
            "stringValue": "emailtmpl_credits_ops_reset_20260713"
          }
        },
        {
          "name": "to",
          "value": {
            "elementReference": "ApprovalEmail_To_Recipients"
          }
        }
      ],
      "connector": {
        "targetReference": "Send_InApp_Notification"
      },
      "faultConnector": {
        "targetReference": "Send_InApp_Notification"
      }
    },
    {
      "name": "Send_InApp_Notification",
      "label": "Bell Notification for Regional Ops",
      "locationX": 0,
      "locationY": 360,
      "actionName": "sendNotification",
      "actionType": "sendNotification",
      "inputParameters": [
        {
          "name": "recipientUserId",
          "value": {
            "elementReference": "$Record.Regional_Ops_User__c"
          }
        },
        {
          "name": "title",
          "value": {
            "stringValue": "Credits approved: reset required in the external billing system"
          }
        },
        {
          "name": "body",
          "value": {
            "elementReference": "$Record.Name"
          }
        },
        {
          "name": "link",
          "value": {
            "stringValue": "/approvals"
          }
        },
        {
          "name": "notificationType",
          "value": {
            "stringValue": "approval_ops_action"
          }
        }
      ]
    }
  ]
}
