You are here:
Create Flows to Generate Payment Instructions
Create a record-triggered flow that generates payment instructions when a claim, payment request, or benefit disbursement meets your criteria.
Required Editions
| User Permissions Needed | |
|---|---|
| To create a business automation flow: | Manage Flows |
Create a separate flow for each object: Claim, Payment Request, or Benefit Disbursement. You define the criteria that trigger each flow. For example, you can trigger the flow when a record's status changes to Approved.
Repeat this procedure for each object you plan to generate payment instructions for.
Create a Record-Triggered Flow
-
Create a record-triggered flow.
- From Setup, in the Quick Find box, enter Flows, and then select Flows.
- Click New Flow.
- In the New Automations window, select Record-Triggered Flow.
-
Configure the Start element.
- Enter either Claim, Benefit Disbursement, or Payment Request as the Object name.
- Under Configure Trigger, select A record is updated. For Benefit Disbursement, select A record is created.
-
Set Entry Conditions.
- Select All Conditions are Met (AND).
- Make your selections for Field, Operator, and Value. For example, to trigger the flow when the record status changes to Approved, set Field to Status, Operator to Equals, and Value to Approved.
- For When to Run the Flow for Updated Records, select Only When a Record is Updated to Meet Criteria Requirements.
- Under Optimize Flow, select Actions and Related Records.
- Click Save.
- Give the flow a name and optionally a description, and click Save.
Add an Assignment Element to the Flow
Use an assignment element to map custom fields from the triggering record to fields on the payment instruction. Two Apex-defined types store the custom values input:
ConnectApi.CustomValuesInputRepresentationcontains a list called "values", with each entry being of typeConnectApi.CustomFieldValueInputRepresentation.ConnectApi.CustomFieldValueInputRepresentationcontains two string fields: fieldName and value.
- Create a new variable to represent custom values of type ConnectApi.CustomValuesInputRepresentation.
- Create a new variable for each custom-mapped field of type ConnectApi.CustomFieldValueInputRepresentation.
-
In the assignment element, assign each mapped-field variable's field name to the string
name of the field on the payment instruction that you want to populate. For example,
customField__c. - Assign the variable's value field to the value you want.
Repeat these steps for each custom-mapped field. Then add all of the field variables to
the custom values variable's values list using the add operator.
Add the Generate Payment Instructions Action to the Flow
- In the flow diagram, under the box labeled Record-Triggered Flow, click the + sign.
- In the Add Element field, enter Generate Payment Instructions.
- For Label, enter Generate Payment Instructions.
-
Set Input Values.
- In the Record ID field, select the triggering object, and then select the record ID field. For example, if your flow is based on Claim, select TriggeringClaim > Claim ID.
- Enable the Custom Values section. In the resources box, select New Resource.
- For Resource Type, select Variable.
- For API Name, assign a name for the custom values input.
- For Data Type, select Apex-Defined.
- For Apex Class, enter ConnectApi_CustomValuesInputRepresentation, and then click Done.
- Save and activate the flow.
Ensure your trigger criteria don't result in duplicate payment instructions. For example, in a social insurance scenario where both the Claim and Benefit Disbursement objects are used, configure the flow for the benefit disbursement record only, not the claim record.

