Accessing flow operations output via script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2025 04:10 AM
Hi experts
I'm trying to access the output of a flow, subflow, or action using scripting. I know that the sys_flow_context table stores information about the execution, but it doesn't contain the actual output data visible in the Workflow Studio Operations section. There we have the action section and in it the Output data.
Anybody knows the name of the ServiceNow table where the real output of a flow, subflow, or action is stored? Is there any possibility to get this information via script?
Basically we execute the flow/subflow/action in background from a business rule and later, in another script we want to get the output.
Thank you!
Dominik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2025 04:17 AM
flow involves lot of other table
What's your business requirement to know where it's stored?
If you are running your flow/subflow/action from script you will always get the outputs
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2025 04:35 AM
Hi Ankur
Thanks for your response.
Use Case: We are running a flow from business rule:
var result = sn_fd.FlowAPI.getRunner().flow(<flowname>).inForeground().withInputs(<inputs>).run();
Now the flow has a wait condition which throws the error: "com.glide.plan.runners.FlowObjectAPIException: The current execution is in the waiting state".
As we need the output we can not just run it in background. Therefore I was thinking to run it in background and as soon as the Flow Context is set to complete, I get the output from the respective table. But I do not know on what table the output is.
Thanks
Dominik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2025 04:47 AM
if it's running in foreground the script will wait for that time
You will either have to use run in background and handle the subsequent processing on that record via flow only
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2025 04:52 AM
No, the flow does not wait if I run the script in foreground. It throws following error because of the 'Wait for condition' in the flow: "com.glide.plan.runners.FlowObjectAPIException: The current execution is in the waiting state".
As I need the output the execution in background is no option if I do not have access to the output later via script.