logo

NJP

Error Handling in Flow Designer - Part 2 | ServiceNow | Rome Release

Import · Aug 15, 2021 · video

hello everyone welcome back to my youtube channel so here i am back with another video for you guys if you guys have seen my last video we discussed about the error handling in flow designer so today we'll be doing uh second part uh to that one so we'll be walking through the flow designer changes that are introduced at the action level for the rom release service now so coming to the topic let's start off so if you have seen my last video you might be already aware that i used a new email account flow for the new email account catalog item that we have and in this i walked through a couple of actions and then the error handling bit that we have got at the flow level now to demonstrate the working of error handling at the action level and you know the new changes that have come up at the action level and working with the action error evaluation and the error handler that we have got to add at the flow level i'll be creating a custom actually i've already created a custom action i've and i've named it as send email these that have been added at an action level for error handling so first thing if you can so this is a create record step that i have and i'm just creating you know i've just mentioned it to create an internet and now as you can see here we have if this step fails option now in this we have got a couple of options over here so first is stop the action go to the error evaluation so again i will be coming a two error duration a bit later on in the video and don't stop the action go to the next step so we can choose either of them now if we select don't stop the action go to the next step what it will be doing is this even if this particular step errors out it will be going to the next step which is the email step that we have right and now in this particular email uh again i am giving out an non random value over here which is not an email so just i because i just want this one this particular step to error out so that we can verify how error handling is working right so and in this one what i've done is i have mentioned it as stop the action and go to the error evaluation so even if the first one fails it will still come to the next step right so that's how this particular functionality is which i particularly feel is pretty cool and and now also in addition to this so every step that we have in the particular action also involves a step status object which in has a code and also has a message linked to it right so the create record step has it the email step has it right and also the flow finally gives out action status code and a message which is basically one of these codes and a message right so again this code is zero if it's all uh goes through successfully and is one if it errors out and this message can be anything like guide record failed you know unable to send email xyz abc anything anything it can be anything we are not really sure what's going to happen but code is always going to be one so one means error and similarly for this and this particular status code and message is being sent out as the action status output and this action status output we can we will be getting this as the output in the flow that we put this action in right so we we can use this in that particular flow to see what happened what went wrong now coming to the error evaluation on the left so in the error evaluation what we can do is we can basically so as i told you earlier we can we can basically we will be basically getting a code and a message and that message can be anything uh anything right it might not make sense directly to the person it might be four four or four page not found you know some something glide record unable to get to the data like whatever it can be so but we want the end user or the admin or you know the person to just see and get an idea directly why exactly this particular action failed right so what we can do is we can override the default error status right we with the new status code and um status message which comes out from the action into the flow right so to start off with i what i'll do is i'll click on the add error condition ui action and i'll click on this particular bill right and i'll involve uh on step two step status and step status so if the email step status is one which is error so we have got an option to don't redesired as a error right we do have an option to do that as well and but yeah right now i want to treat it as error so i will be getting a [Music] status code of 1 but i want to give it out as 302 right and i want to give out a message ending email failed right so this is something custom that i want to send out and yes and we can also add multiple conditions for different steps that we have but right now i'll be just doing one and save it publish publish now once this is done i will be going back to the flow and i will be removing the send email out of the box action that we have and i will be involving um send email so i will be using the custom send email that i have configured i i'll be clicking as done so once i have included this if i go on the right side you can see that it's giving out a action status object right so and a code and a message right so now what i'll do is i will save it activate it while this is getting done i will quickly go to the portal and i'll submit a catalog item now once this is done basically so one time here i'll close off the task as we have what the task with so once this is done flow context so now here we are uh as you can see this particular action failed and it has given out a code of 302 sending email failed because our step send email failed due to obvious reason that we have not given the correct email address over there now if we go in depth with the steps right so the first step went fine it created an instrument with a status code of zero and a success now the second step email step email validation failed email contained the following invalid receipt addresses right so at as you can see at the step level this particular code is one and the message is same message that we can see here email validation field email contained the following invalid recipient address right so now this particular message was overridden by our custom message custom code and custom message that we have set in in the action in the error evaluation bit right so this is how it works we can modify the particular code and the message that we are getting out of the flow uh as you know out of the action to the flow and going forward we can also if i go back to the flow we can also have some logics over here to do some things if our status code or particular step is you know something so i will go i'm in the flow right now uh error handler and i'm adding a if here so if send email action status code is 302 it i want to create something like and to basically create a record i want to create an incident now when this particular handling bit is executed right it will also check okay so error occurred at this particular and the code is 302 it will create a separate incident for that right so this is uh basically how we can work around with the the error handling around flow and action and back from the action to the flow and we can again have multiple conditions over here for every particular action that we have if the create catalog task action status is action status code is one we can have if condition so yeah we can we can play around with it and yes so to summarize this in we have got action we have got options to select what to do at a step level in the action stop the action go to the revolution don't stop go to the next step right and also every particular step in uh in the action gives out a code and a message which is either 0 1 and 1 is for error 0 is for a successful execution and in addition to this we have got the error evaluation where we can override the default uh error status coming out from that particular step and this uh action status code and action status message is further sent out to our flow where we are using this action just in case that particular condition is met and the error is occurred right and further down we can also add conditions in our own uh error handling at the flow level to cater something special for this particular error if it occurs yeah that's all uh that's all for the error handling with the actions and flows so thanks for watching

View original source

https://www.youtube.com/watch?v=dAxGqUwnWqk