Start an Action in a Flow

Last published at: 2024-07-04 14:13:52 UTC
Delete

Starting an Action in a Flow is available for the Premium and PDM licenses.

Execute a DAP Action (preconfigured in a Macro) as a flow action, on one or more records gathered earlier in the flow.

Delete

This article is about starting a DAP Action within a Flow. For running a Flow as a DAP Action, see Run A Flow action‍.

In a flow, you can choose from two flow actions to add a DAP Action to the flow: 

  • DAP - Start a macro with a DAP job  
    Start a macro asynchronously by passing a list of record IDs and the macro's API name to this flow action. 

  • DAP - Start a macro with single record
    Start a macro synchronously by passing a single record ID and the macro's API name to this flow action.

Prerequisites

To run a DAP Action within a Flow, you need:

  • The DAP Action  you want to run, preconfigured in a Macro. 
    • The macro should be intended for the same object as the records in the flow.
      Some macros can be used for all objects (e.g. macros based on Mass Delete), but most are set up for one specific object.
    • Enable the macro for Start from a Flow for each applicable profile or user. In the Action Library‍, click Assignment to change this.
    • Note down the API name of the macro. You can find the macro API name in the Action Library‍.

Read more about creating Macros here: Macros‍.

  • An Autolaunched or Record-Triggered Flow.
  • A flow Variable or Get Records action earlier in the flow, for gathering record IDs to apply the DAP action to. With the Single Record action, some record IDs can be selected directly, without needing a flow variable.
    • If you use a variable, it should have Data Type: Text.
    • A Get Records action should be set to Store all records for the 'DAP - Start a macro with a DAP job' action.
    • Keep in mind that the action can process a maximum of 1560 record IDs.

Add an Action to your Flow

  1. In your flow, click Add Element and select Action.
  2. Add the DAP - Start a macro with a DAP job or DAP - Start a macro with single record action.
  3. At Label, enter a name for the action.
  4. At Object for "Record IDs" (input), select the Object (if not yet specified earlier in the flow). This should be the same object as used in the macro.
  5. At Flow Name and Version, enter a clear name for the flow, so that you can easily find the results in the audit log later on. You can enter a version number as well, and update it if you make changes to the flow in the future.
  6. At Macro API name, enter the macro API name you copied earlier (see Prerequisites).
  7. At Record IDs, select the variable that contains the record IDs.
    Note that the action can process a maximum of 1560 record IDs!
    If you haven't specified an object for a Single Record action, make sure the record ID used here is for the same object as the macro.
    For a Single Record action in a Record-Triggered flow you can also select the record ID of the record that triggered the flow.
  8. At Advanced > Manually Assign Variables, indicate where to store output values (optional).
    For the Single Record action you can store the Macro Status and Record ID.
    For the DAP Job action you can store the DAP Flow ID.
  9. Click Done.

The DAP Action is now added to your Flow. 

Results

The Single Record action returns the status of the macro: it will state whether running the macro succeeded or failed. 

The status of a DAP job that was started via the DAP Job action can be tracked in the Job Overview in DAP.
The DAP Flow ID that is returned as output value can be used in an Apex Class to fetch the job status. See Start an Action from an Apex Class‍ > Get the DAP Job status for more information.

Furthermore, the Audit Log (if enabled) and the Job Information (if a DAP Job action was used) will show that the macro was started from a flow, with the flow name and version you entered.