{
  "apiVersion": 56,
  "label": "Credits — Notify Submitter on Rejection",
  "description": "Approval-notification Flow (proposal §0 Phase 3 item 2). Invoked ONLY by the approval lifecycle bridge via ProcessAction ActionType='Flow' rows bound to the FinalRejection event of both Credits chains; no record trigger by design. Recipient = the bridge-injected Approval.SubmitterUserId. Dual channel: email via resolveEmailRecipients + sendEmail (template emailtmpl_credits_submitter_rejected_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. Approval has its own sibling Flow (Credits_Notify_Submitter_On_Approval).",
  "processType": "AutoLaunchedFlow",
  "status": "Active",
  "start": {
    "connector": {
      "targetReference": "Resolve_To_Recipients"
    },
    "locationX": 0,
    "locationY": -120
  },
  "variables": [
    {
      "name": "ApprovalEmail_To_Recipients",
      "dataType": "String",
      "isCollection": true
    }
  ],
  "actionCalls": [
    {
      "name": "Resolve_To_Recipients",
      "label": "Resolve Submitter Email",
      "locationX": 0,
      "locationY": 0,
      "actionName": "resolveEmailRecipients",
      "actionType": "resolveEmailRecipients",
      "inputParameters": [
        {
          "name": "userIds",
          "value": {
            "elementReference": "Approval.SubmitterUserId"
          }
        }
      ],
      "outputParameters": [
        {
          "name": "emails",
          "value": "ApprovalEmail_To_Recipients"
        }
      ],
      "connector": {
        "targetReference": "Send_Email_Notification"
      }
    },
    {
      "name": "Send_Email_Notification",
      "label": "Email Submitter (Rejected)",
      "locationX": 0,
      "locationY": 120,
      "actionName": "sendEmail",
      "actionType": "sendEmail",
      "inputParameters": [
        {
          "name": "templateId",
          "value": {
            "stringValue": "emailtmpl_credits_submitter_rejected_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 Submitter (Rejected)",
      "locationX": 0,
      "locationY": 240,
      "actionName": "sendNotification",
      "actionType": "sendNotification",
      "inputParameters": [
        {
          "name": "recipientUserId",
          "value": {
            "elementReference": "Approval.SubmitterUserId"
          }
        },
        {
          "name": "title",
          "value": {
            "stringValue": "Your Credits request was rejected"
          }
        },
        {
          "name": "body",
          "value": {
            "elementReference": "$Record.Name"
          }
        },
        {
          "name": "link",
          "value": {
            "stringValue": "/approvals"
          }
        },
        {
          "name": "notificationType",
          "value": {
            "stringValue": "approval_decision"
          }
        }
      ]
    }
  ]
}
