---
schema_version: "1"
id: 094d4121dc34ec0565a973bde978646ea0e3fc90a19a0b849aa06f3295b6c406
title: Create Flows to Generate Payment Instructions
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/aps_outbound_payments_flows.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.aps_outbound_payments_flows.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 04935c39227d6338d9e7581e8a4729655100a783e1ca3809b579dd817cd4b860
description: Create a record-triggered flow that generates payment instructions when a claim, payment request, or benefit disbursement meets your criteria.
products:
  - Public Sector
release: "264"
---
# 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

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:left;vertical-align:top;" id="d119002e38">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d119002e38 ">To create a business automation flow:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d119002e38 ">Manage Flows</td>

          </tr>
        </tbody>
      </table>

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

1. Create a record-triggered flow.
    1. From Setup, in the Quick Find box, enter Flows, and then select **Flows**.
    2. Click **New Flow**.
    3. In the New Automations window, select **Record-Triggered Flow**.
2. Configure the Start element.
    1. Enter either Claim, Benefit Disbursement, or Payment Request as the Object name.
    2. Under Configure Trigger, select **A record is updated**. For Benefit Disbursement, select **A record is created**.
3. Set Entry Conditions.
    1. Select **All Conditions are Met (AND)**.
    2. 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.
    3. For When to Run the Flow for Updated Records, select **Only When a Record is Updated to Meet Criteria Requirements**.
    4. Under Optimize Flow, select **Actions and Related Records**.
4. Click **Save**.
5. 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.CustomValuesInputRepresentation` contains a list called "values", with each entry being of type `ConnectApi.CustomFieldValueInputRepresentation`.
- `ConnectApi.CustomFieldValueInputRepresentation` contains two string fields: fieldName and value.

1. Create a new variable to represent custom values of type ConnectApi.CustomValuesInputRepresentation.
2. Create a new variable for each custom-mapped field of type ConnectApi.CustomFieldValueInputRepresentation.
3. 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`.
4. 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

1. In the flow diagram, under the box labeled Record-Triggered Flow, click the + sign.
2. In the Add Element field, enter Generate Payment Instructions.
3. For Label, enter Generate Payment Instructions.
4. Set Input Values.
    1. 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.
    2. Enable the Custom Values section. In the resources box, select **New Resource**.
    3. For Resource Type, select **Variable**.
    4. For API Name, assign a name for the custom values input.
    5. For Data Type, select **Apex-Defined**.
    6. For Apex Class, enter ConnectApi\_CustomValuesInputRepresentation, and then click **Done**.
5. 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.