- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2023 02:09 AM
Hi,
I have created a subflow which I triggers from BR using sn_fd.FlowAPI.getRunner().
This was required as subflows can accept proper inputs and I need to trigger this flow from sc_request level with advanced conditions, which are not available for the main Flow trigger record insert conditions. ServiceNow also support this approach: Types of flows and when to use them (You want to start a flow by calling it from another flow or script).
All is working well in the Subflow, except the Error Handler.
In the Flow which I had before, if a custom action threw an error (Don't treat as error=FALSE), the Error Handler actions were triggered and it worked fine. I also inspected that the Flow status in Execution details was Completed (error caught):
which then triggered Error Handler actions:
In the Subflow however, same exact logic applies, but I no longer get Completed (error caught), but I get Error instead:
Could it be that the reason why Error Handler does not run is because I triggered this from the TEST button and not the BR script using FlowAPI?
Due to this, the Error Handler actions are skipped and look like this in execution history:
This is what it looks like in the subflow for this custom action:
This is what it looked liked before in the flow (same exact custom action):
According to documentation:
- Completed (error caught): Generated when a flow identifies an error and executes the actions, flow logic, or subflows in the Error Handler section successfully.
- Completed (error skipped): Generated when an action continues running after a step fails.
- Error: Generated when an error is not identified.
- An error occurs in a flow while the Error Handler is disabled.
- An error occurs in the Error Handler section.
The whole point of the Dont't Treat as Error = FALSE was to catch the error and then go to Error Handler. If I keep it as TRUE, then the custom action will have state of Completed (error skipped) and the Subflow will keep running, which is unwanted behavior.
Any suggestions how I can trigger the Error Handler inside the Subflow if an error occurs?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2023 07:55 AM - edited 11-10-2023 07:57 AM
I ended up disabling the Error Handler completely in the Subflow and moving the error handling actions behind an IF condition and modifying the custom action's Dont't Treat as Error to TRUE instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2023 07:55 AM - edited 11-10-2023 07:57 AM
I ended up disabling the Error Handler completely in the Subflow and moving the error handling actions behind an IF condition and modifying the custom action's Dont't Treat as Error to TRUE instead.