Skip to main content

Hello, I have a very simple scheduled flow that only calls an invocable method. When I debug>Run it, it fails with a Callout exception ! (cf picture below) 

System.CalloutException - uncommitted work pending - But no DML before callout ?But when I call (in anonymous action) directly the method called by the action, it works fine !

 

I have check several times but i think I respected the prerequisites

  • I do no insert / no update / no upsert before the external call (just a custom setting query to get the information & parameter for my upcoming callout) 
  • then I do the external callout to retrieve data from an external system
  • and then, in a future method, I parsed the http response, build the list of data to upsert, call the collection upsert action, and an action to update the custom setting timestamp value.

I have cleaned all paused/failed flows interviews by precaution.

 

Have you any ideas on what could generate this error ?

Thank you in advance for your help 

 

BR

Eric 

9 risposte
  1. 12 lug 2023, 00:58

    @Eric Burté

    I have successfully reproduced your issue and identified its cause and solution. Please refer to the following article:

    "A schedule-triggered flow can make callouts only after executing a Pause element. For example, without a Pause element, the flow can't access external objects, execute Apex actions that make callouts, or execute actions that are generated from External Services registrations."

    https://help.salesforce.com/s/articleView?id=sf.flow_considerations_trigger_schedule.htm&type=5

     

    The likely cause of the issue you are experiencing seems to be the absence of a Pause element when making callouts from a schedule-triggered flow. In fact, as demonstrated in the screenshot below, I was able to reproduce your problem, and it was resolved by adding a Pause element.

    I hope this information is helpful to you.

    I have successfully reproduced your issue and identified its cause and solution.

    Comp_20230712.png

0/9000