2

I have an autolaunched flow that calls a third-party API and while the flow works in debugging mode and as a screen flow, I receive the below error when I try to call the flow from Process Builder

Error Message:

Callout failed: The callout was unsuccessful because of pending uncommitted changes related to a process, flow, or Apex operation. Commit or roll back the work, and then try again. For more information, contact your Salesforce admin

From my research this seems to be an error related to not being able to have flows run asynchronous. The workarounds I've found include scheduling the flow with a 0 hour wait time after the record is updated, but I still receive the callout error.

My current Process Builder flow is:

  • Start
  • Custom Object is Created
  • Conditions of Custom Date Field is equal to TODAY() are met
  • Immediate action updates a checkbox from False to True
  • Scheduled action of 0 Hours After LastModifiedDate
  • Call Autolaunched Flow
  • Error Message is sent

Has anyone successfully called an external API from Process Builder? The articles I've referenced include:

Many thanks for your help! Cheers, Chris

1 Answer 1

1

I had the same problem and solved it using Platform Events. Didn't see anyone mentioning this solution, so here it is...

  1. Create a new Platform Event (object) with fields necessary for your callout.
  2. Use process builder (or flow, or API, or APEX) to publish it.
  3. Create a "Platform Event-Triggered Flow" with your API callout.

This flow will now be independent of the original transaction. The Platform Event essentially makes External Services or other API callouts asynchronous in the Flow. Please read the Platform Events documentation for more details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.