Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Sohail Khilji
Tera Sage
Tera Sage

Handling ServiceNow flow errors with a flow

ServiceNow is promoting the LowCode / No-Code approach very strongly with their flow engine. Flow is the new way of creating a workflow fast and without any huge programming. I’m not very familiar with the ways how it worked in past releases as I started out with the Paris release and with that, I already entered the world of the flow engine. But it doesn’t matter how easy it is to create a flow, the most important part is that the flows run without errors. And here is some kind of a lack when it comes to flows. They get tracked of course if they are running into an error but there is no kind of information or something

As a system administrator or even a workflow responsible administrator, I would like to know when a flow throws an error so I can investigate why it happened and prevent it in the future. And we all know that issues will come up nobody thought of during development and testing.

how to keep track of errored service now flows

There is actually a table that tracks all flows with all their status: sys_flow_context
Here you can filter for errored flows and check each one individual what was the root cause of the issue. This is one way you can actually check from time to time how your flow engine performs, how many flows are open, and what errors came up.

But… often you need to get informed immediately if a flow runs into an error. You have to act on this, prevent it in the future, etc. So why not leverage the flow engine to check for flows with an error state?

create an incident when a flow is in error state

If you are using the IT Service Management module (probably most ServiceNow customers) you can actually create a flow that checks the “sys_flow_context” table and create an incident as soon as a flow gets into the state “Error”.

StepDescription
TriggerStart if a flow is created/updated and has the state “Error”
Action 1Create an Incident Record
Action 2Update the Incident Record with whatever fields you need.
My updates:
– Short Description: Flow Error: <Trigger->Flow engine context Record->Name
– Work Notes: Dynamic Link to the actual flow with the error

For the Work Notes link you can use the following script which will dynamically create the link to your respective flow with the error:

var flowSysId = fd_data.trigger.current.sys_id;
var url = '/$flow-designer.do#/operations/context/' + flowSysId;

return '[code]<a href="'+url+'" target="_blank">Go to Flow</a>[/code]'

If you know get a new or updated flow you can directly act on the incident that gets created.

Have fun with that and improve your flows!

 

 

 

If this article helped you in any way please mark it helpful or bookmark it for future reference

Thanks,

MF Sohail Khilji.

LinkedIn - https://www.linkedin.com/in/mf-sohail-khilji/

 

Comments
G_13
Mega Explorer

Hi,

 

I implemented a similar flow in our organization's implementation. However, in production, it is not triggering at all while there are several errored flow executions. Does it need to be set to Run "Only if not currently running" ?

Omender Singh
Tera Guru

Hello,

 

Please have a look to the use of ServiceNow error handler in flow in below video.

 

Version history
Last update:
‎12-01-2021 01:52 AM
Updated by: