- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 03:14 AM
Hi all,
I am trying to write a generic error handler for flows that should cover if for example a task is skipped, fails or not resolved correctly (as stated so in the business requirement). If an error occurs an incident should be created. The creation if the incident is no problem at all. The problem is gathering information to put into the description-field of the incident.
I have made a subflow, and need to get as much information as possible about the parent flow. From what I can gather by googling and checking this site, not much is being exposed.
I have looked a bit at the FlowAPI without any luck, perhaps it's just a matter of putting the right things together in the right order. The FlowScriptAPI returns the context ID of the subflow, unfortunately not the parent flow.
It would be possible to add a call to the FlowScriptAPI in the parent script and relay that contextID to the subflow as an input, but I would like to keep as much error handling as possible within the subflow itself, so the persons building flows only need to add a call to the error handler subflow, and not having to worry about adding other steps but the call to subflow.
Has anybody done something like this, where the error handler should just be called from the parent flow without the need for a variable in the parent flow that states the flow name and so on? No life hack whatsoever on this issue?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 04:33 AM
This video I made a while back should show you how to do it.
Create an Error Handling Subflow with ServiceNow Flow Designer
Includes how to get flow and parent flow contexts.
https://youtu.be/Br5p7inqbXw
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 03:48 AM
The 'source record' on the subflow execution contains the sys id of the flow engine context. Maybe that's something you can use to do a lookup and get the information.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 04:33 AM
This video I made a while back should show you how to do it.
Create an Error Handling Subflow with ServiceNow Flow Designer
Includes how to get flow and parent flow contexts.
https://youtu.be/Br5p7inqbXw
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 05:26 AM
@Uncle Rob That's a great and detailed video, thanks!
I almost got it to work based on it, but the description that's logged to the incident looks like this in my example:
CODE: 1
MESSAGE: {
"code" : 1,
"message" : "Error: This step is designed to fail intentionally. (Process Automation.2721c932fb562250bf98ff22aeefdcd6; line 3)"
}
I noticed in your video, that you just had a much cleaner error message. Any idea why my shows up like that?
I am using an action to manipulate an error. The only thing it does is this:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 01:40 PM
Send screenshots of the action definition and hte output you get and i'll be happy to take a look.