Run Flow Asynchronously In Salesforce

by Rijwan Mohmmed
run-flow-asynchronously-in-salesforce-techdicer

Hello friends, today we are going to discuss Run Flow Asynchronously In Salesforce. We added asynchronous paths that run in the background and don’t delay the execution of your original triggered transaction. Use an asynchronous path to execute a long-running operation, such as a callout to an external web service or any operation that you want to run on its own time. You can also use an asynchronous path to avoid the mixed DML error.

Also, check this: Scheduled Paths Flow In Salesforce

Key Highlights :

  1. We can avoid mixed DML errors in flow.
  2. We can invoke callout after DML.
  3. Used to break the transaction.
  4. We can’t define a time for an asynchronous path to run as you can for a scheduled path. And in situations when system resources are unavailable, the execution of an asynchronous path will be delayed.
  5. Both asynchronous and scheduled paths are subject to the same asynchronous per-transaction Apex limits.
  6. Only available for After trigger Flow.
  7. Checked the checkbox of Include a Run Asynchronously path to access an external system after the original transaction for the triggering record is successfully committed.

Process :

Here we will create a Trigger flow which we call when after the user record is created. We will create a contact record after that because, without the use of an Asynchronously path, we will get mix DML error. We use the Asynchronously path for this.

Step 1: First of all we will create a trigger flow. Navigate to Setup > Flows > click New Flow. Create a Record-triggered flow. Select Record-triggered Flow and then click Next.

Scheduled Paths Flow In Salesforce-24
Run Flow Asynchronously In Salesforce

Step 2: Here we will setup up object and Entry Conditions. Also, Select Action and related records at the Bottom. Also Checked the checkbox of Include a Run Asynchronously path to access an external system after the original transaction for the triggering record is successfully committed.

Step 3: Now in Asysn Path we add Create record element and set up the contact record fields for creating the contact record.

Output :

Reference :

  1. External System Using an Asynchronous Path
What’s your Reaction?
+1
2
+1
1
+1
0
+1
1
+1
0
+1
0

You may also like

2 comments

Jean October 27, 2023 - 7:16 pm

Once the Asynchronous action is completed, how can the flow be notified (callback) to then move to another step that depends on the completion of the Asynchronous step?

Reply
Rijwan Mohmmed October 30, 2023 - 4:04 am

Create a subflow.

Reply

Leave a Comment