logo

NJP

#7 How to lookup records in ServiceNow with Flow Designer | Flow Designer Training

Import · May 09, 2021 · video

[Music] please subscribe to my channel and click on the bell icon to get the regular updates of my channel and do not forget to like comment and share hello everyone welcome back to sas with servicenow this is part of servicenow flow designer training in this video you will learn about lookup rackets core action of flow designer in servicenow lookup rockets is replacement of glide record query if you get a requirement in which you have to write a business rule like a server side code and you have to do a query to check some data maybe to perform some action on those rackets you always write a glide racket query so basically lookup racket action is replacement of glide racket query script so in flow designer you do not have to write any script and you can just use lookup rackets so let's see how exactly you can use lookup brackets to achieve some functionality this is my personal developer instance i will show you this example with a use case let's say you get a requirement in which you have to check all the catalog task service catalog tasks in a particular requested item if all those catalog tasks are closed then you can close complete request item automatically if all the catalog tasks associated with that particular request item are closed complete so how can you achieve this so i will go to the flow designer which i have already opened in the new tab i will create a flow for this i will click on flow and here i will mention demo close request request item request item and i will click on submit now what will be the trigger point so we have created the flow but we have to now add the trigger point so trigger point would be because you have to check so whenever a catalog task will be changed to close complete you will check that hey do we have all other catalog tasks associated with that requested item of this catalog task is closed or not then only we will close the requested item so for that you will just click on update trigger will be updated which table that will be catalog task and we have this sc underscore task table and here i will add the filter so i will mention state so basically when state changes to close complete so when state changes to close complete then you have to take this action so i will click on done and now i will add action now what exactly i have to check i have to check the request item associated with this particular record if whatever whatever catalog task that particular request item has whether they are closed or not how can you do that so if i talk about your scripting you will do glide racket however in flow designer you just have to use action without scripting and that is look up record or look up records both are kind of similar however if i if i give you the quick example of your glide record query in which you put if which returns only one racket that is lookup bracket and if you use vial which will basically lube the whole table for all the condition you have mentioned your glide racket query that will return lookup rackets if it has more than one racket so if it has more than one racket it will definitely return more than one record as an output but if i talk about lookup bracket even it has 10 records but the first record will be returned so we in this case we will use lookup rackets the reason is we want to check the whole catalog task so i will just select the table now i will mention that is catalog task table again and here i will put the condition so condition would be the request item which is the requested item is same as the trigger record so i will select the request item it should be same and then i will mention state here i will mention is not close complete because we are searching for the rackets so state is not close complete if i will if i will get let's say more than zero rackets even one racket is available so where state is not closed complete maybe it could be it could be work in progress close incomplete or close skipped or open it can be anything or maybe i think i would say is you should always do is not one-off because you want to close complete even with these conditions as well so is one off close complete close skipped in that case you will close the requested item so if we have state is not one off and then i will just click on done then you can add flow logic so we will add flow logic here if and here basically i will count the racket so we have to count for the catalog task records where state is not these three states and if it is more than zero then it it should not basically update the requested item but if that particular count is zero so how can you count it i will show it to you again i will cancel this i will select here i will select the lookup brackets this one and i will click on count and i will mention zero if it is zero that means all the catalog tasks are closed now then i will update the racket how will i update it i have to update requested item so for that i can just select the update racket look update racket action which you can find here as well update racket here i have to select the racket and table so how can i select it i can just look from the here so i can go to the catalog task i will select the requested basically request item that is what i have to select here we have request item and then i have to add a value that will be state so you will add a state here so you can just mention state and state is close complete you can click on done and that's it this will update the same record and i can just click on save and i will activate this flow but just to reiterate against overall you are triggering the flow with the help of catalog task updated so any single task any catalog tasks will be changed to close complete it will trigger this flow that's the first thing second thing it will look for the records for the same request item in in this particular record and check what all catalog catalog task records we have with this requested item and all those catalog tasks if we have any single catalog tab which is not closed then this action will not be taken however if it returns zero that means there's no catalog task where we have all these is not all these states then it will update this requested item bracket so i will activate this now i will click on ok and i will just test it so let's go here and we will go to catalog item um i will go to service catalog we will try to request one of the one of the catalog item we have here microsoft access uh maybe i will yeah select this one i will click on order now this will be ordered and you can see we got request number let's see if we have any approval because that is really needed uh we have just so we don't have any approval here i will click here requested item and yes we have just one catalog task right now what i will do i will just create additional catalog task but that's how we can validate we can do this testing so i will click on test and now i will just click on submit so i have created one catalog task overall we have two catalog tasks in this particular requested item as of now both the states are open what i will do i will close complete this one so i will click on close complete and i will update it it is closed i will come here and i will reload it and now you can see it is closed complete and state is still open that means our flow has not executed okay maybe it has triggered but action was not taken because it is not matching up the condition we can see that how click on executions and yes we do have one one execution here if i open this and now you will be able to understand that how exactly it is working you can see it says evaluated false it looked up for the records however we are not getting any any record here because it evaluated false how can we make it true so i come over here and i will let's say i will basically close complete this one so i will open this catalog task i will do close complete you can select any other state because that's what the condition we have mentioned i have made it close complete so we have changed to close complete you can see it also tries to update that and then i will cancel this and yes we got second execution as well and this one was created latest so i will open this one and it says evaluated false again and if i go to my record it is it is saying awaiting delivery let's see that i open this okay that's a reason because it created other catalog tasks that's fine let's close it again we will see how exactly it is behaving so i will make it close complete again let's see what will happen okay i hope this time we will get some records i will yes we got in queue i will open this one now it is still executing yes it says closed and now i will open this okay it says evaluated false let's see if we got another catalog task yes that's the reason guys so overall our flow is still working fine without any issue but that's fine i will open this one again and this time we will close this one so i will just make it close complete i will save this let's see if this time it will trigger this and it will have some records i am refreshing this i think it's still running it says in progress i think this time it should run it is still saying no it says evaluated false i'm surprised that how many tasks it has that's i think it only has five one but why yes we got fifth one oh my god okay that's totally fine i will just open this one at least our flow is running totally perfectly fine so i will just this time close complete this one save this and i will see whether our flow got executed or not yes it got executed and it is in queue right now it says complete we will open it and yes you can see here it evaluated true and if you open this count is zero okay and it says evaluated true that means it got it got at least one at least not not even a single value not one value not even a single value in previous cases when it was basically evaluating false it was able to find more than one racket and yes it was able to find more than one record that's the reason it was net not executing that means this step was evaluating false however how can you say this is completely running fine you can do that by clicking here and see the state yes we got it so if i reload the form you can see it has changed the state to close complete and how can you know that it has basically ran this particular flow successfully so i can make a quick change what i will do i will go to the flow i will go to the flow here and i will add another action and that action will be add a work note link i will add to the same table basically this where we are this updating the racket same and the racket would be same racket which we are actually updating and we will put in the work notes and closed the ritm and i will click on done and i will click on save and i will activate it again now this is a very great feature we have in flow designer just to confirm whether our flow ran successfully or not for that particular uh flow so or for that particular racket so it is still saving but i was i can go to uh the flow basically the catalog item so that i can submit it again so i will go to software i will click on this microsoft access i will click on order now and we have got this i will click on microsoft access basically we got the requested item and this time i don't have to create a new one because we already have this feature here but i will just do one thing i will close all the previous catalog tasks so now i will close all these catalog tasks one by one save and i'm sure it will create another one yes i will close complete this one as well i will close complete this one close complete i will definitely get second one now and let's see if we have work notes or additional yes we do have work notes here and if i reload it yes i will close complete this one again i will close complete save it and i will come over here again and i will refresh fourth one now and i will come here close complete as of now yes our flow is definitely executing but it has it has not updated the racket now i will definitely get the fifth one now this will basically update the record okay only four we had five because we added extra catalog task and if i go at the top absolutely you can see it got closed complete and our flow executed successfully so this basically give you the proof that yes your your flow definitely ran successfully executed successfully without any issue so that's how you can do basically a glide rack and look up brackets in service now with flow designer and that is also without single line of code and you can update multiple rackets and multiple tables in service now thank you for watching and have a great day and if you like my video please do not forget to subscribe to my channel like my videos and share my videos as well thank you have a great day

View original source

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