logo

NJP

#9 How to use Wait For Condition in ServiceNow with Flow Designer | Flow Designer Training

Import · May 15, 2022 · video

[Music] hello everyone welcome back to sas with servicenow this is part of servicenow flow designer training you might have received a lot of requirements in which you have to wait for a condition of a record whenever you're working or users are working on different types of records be it incident change problem or any other records of servicenow platform and when that condition condition matches then you want to perform some action maybe you want to send one email you want to do some query to the records how exactly you can achieve this in servicenow with flow designer so servicenow provides an action which is called wait for condition so if you get this kind of requirement then you can achieve it without writing a single line of code with this action that is wait for condition so let's see how you can use this wait for condition for different types of requirements you get from your customers and clients so let's move to our personal developer instance this is my personal developer instance and this is flow designer so i will create a new flow so in order to use that wait for condition action we have to create a new flow so i will provide a name as demo dot then demo dot incident and i will just mention run as user who initiates session i can select the role maybe the role could be itil and i can just submit this in order to show you the demo i need to create a flow so that's the reason i have created the flow and i will click on this add a trigger i can also basically increase the screen so so you can see all the all the steps properly so here i will just click on add a trigger i can just select created then here i can just select incident and i will trigger this when [Music] basically state or priority i will just mention priority is critical so that's my trigger condition so whenever priority one incident will be created this flow should trigger so then we have action now before i select wait for condition i will select any other action so maybe let's say i will just select um i can select maybe email so i have this send email and i can select the target record that would be incident and here i can select the recipient here i need to select the email address so i can select assign to and that is also email so whenever you select in flow you always have to select that email field so now here's the email and i can just mention demo or maybe incident as p1 and same thing i can just mention here so i will just mention incident is p1 and i will just click on done so this is my first action now the requirement is that whenever state changes to on hold then it triggers something maybe it triggers a notification or maybe it can update a comment so what i would do update a work node in the incident only that incident is on hold something like that so let's say i go to x next here i will select action and that action name is wait for condition wait let me select yes so we have here wait for condition and here you can see it says wait for condition action causes the flow to wait until the record matches the specified condition use this activity to block the flow indefinitely until a particular condition is met you must populate the condition field now before i show you that how to use weight for condition it's really important to know for weight for condition action is that that when you will use this so let's say you have a flow you have triggered it and you have performed some action let's say email action what it will do basically it will complete the flow after performing those actions whatever action you have selected but let's say if you are using weight for condition it will basically keep the flow in waiting condition until that condition is matched and then it will perform the action after matching the condition mentioned in wait for condition configuration and then it will complete the flow so basically it will wait indefinitely that is the main thing so you have to use this weight for condition action as per the requirement requirement you get from a customer but you have to make sure that you are using it in the right way so what i will do i will just select wait for condition and when you select wait for condition so it says what record you want to wait for so we will wait for that incident record and here i will mention state is basically hold so it's on hold and i can show you it's it's basically selected on hold so you can see it says state is on hold and i can just click on done i think there are some other uh you can see other options as well like enable timeout you have duration as well that it should if you don't want this wait for condition to wait uh basically for uh indefinite you you want to do some time out then you can also select this timeout so we here we have uh duration and we will not mention these uh options and i will now directly go to here and what i will do i will basically update or update the record so i will select update and here we have this update record i will update the same record when state changes to on hold and i will mention here let's say work notes and i will mention incident is on hold by flow and it's just an action i have added a comment incident is on hold by flow just to recognize the same work node we have added so i will just click on save and i will activate this so now i will show you the exact flow that how exactly it basically makes and a particular flow in waiting condition when you add this wait for condition action so i will go to incident and i will basically create a new incident so here i will create a new incident and i will select abraham lincoln here i can just mention demo for weight for condition i can select the assigned to the reason behind it because we have selected assigned to email in the send email action and i will create a p1 priority incident so i will select impact and urgency as hi and then i will just click on save and i will click on save it will basically trigger this particular flow and i will go here i will go to execution and you can see demo dot incident so it is in waiting condition so let's see how exactly this shows in the logs in the execution details so see our incident was created it sent that email that got completed but now because we have added this wait for condition action it is waiting it will wait until that condition is matched how we will do that so we will go here we will change the state to on hold i will make the on hold reason as awaiting vendor and now i am going to change this to save i'm saving this so it will become on hold so incident is saved it is on hold and if i will come here and if i just reload it see it got completed because condition got matched and after that your action was to update the record and if i will go in incident and yes you can see incident is on hold by flow it automatically got updated how exactly it got updated it got updated by this particular flow so you can see it says update record i can show you here as well in the logs so this is the incident it is basically taking the input from the flow and here it says work in underscore nodes called incident is on hold by flow so it's done so overall now you can see that this got completed after this step only until then if this condition is not matched then it will still show you as waiting so whenever you see waiting state so you can always check the execution detail that it that particular flow should be waiting for a particular action to be completed or maybe you have waiting for condition wait for condition action where exactly it is waiting for that particular condition to be matched that's how you can use wait for condition action in flow designer and deliver the requirement for your customers and clients thank you for watching this video and have a great day [Music]

View original source

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