ServiceNow Learning 72: Different between calling Flow asynchronously or synchronously.

Shamma Negi
Kilo Sage
Kilo Sage

Hi All,

 

Today, I have found how do you call your flow from the server-side script asynchronously or synchronously.

 

Flow, subflow, and action code snippets all follow the same structure. The code snippet is a function that includes a try/catch statement to catch any errors. The code snippet includes both the asynchronous and synchronous methods. Do not run both the asynchronous and synchronous methods, as the flow, subflow, or action will execute twice.

 

ShammaNegi_0-1700649657262.png

  • inputs object: Subflow inputs and action inputs are defined in an inputs object. Flows with a record trigger accept a record as the input. Developers need to supply values for the inputs. Each input includes a comment that describes the type of information expected.
  • Asynchronous method: The asynchronous method is commented out by default. To call a flow, subflow, or action when no information is required back from it, uncomment the line with the asynchronous method. Delete or comment out the synchronous method.
  • Synchronous method: The synchronous method is used by default so the script can use any information output from the flow, subflow, or action.
  • Output variables: Outputs from a subflow or action are captured in variables to use in subsequent script steps when called synchronously. For example, a developer could take the outputs from an action to update a record.

 Hope this helps.

I hope this article helpful. Please mark it as helpful and bookmark if you like it.\

 

Regards,

Shamma

 

 

Regards,Shamma Negi
0 REPLIES 0