How-To Add a User to a Watch List Based on User Attributes
hey guys justin here with crossfuse and i had a really interesting use case come up on a customer call the other day let me talk you through it real quick essentially a person works in i.t and they're responsible for certain departments they're like the it liaison to those departments and they thought it would be nice if when someone from one of those departments opens a ticket and servicenow to go ahead and add that person who's responsible in i.t to the watch list this gives them visibility into kind of what's going on and in their use case there's probably three or four different liaisons for all the different departments and i was like sure that's super easy you could do that in a flow it's no problem so i wanted to show you how easy that is to configure and service now now in my demo environment i don't have any departments and rather than try to figure out how to get all my departments in there i'm going to use company but just change this to department in your example and it'll work the same way so let's not waste any more time and then get started on how this works so i'm going to start with flow designer and the reason i want to use flow designer is that it's simple to use drag and drop and allows me to kind of see very quickly exactly what i'm trying to do the scenario we're going to do is if a ticket will use an incident is created then add this person or look up their user record and add them to the watch list for that ticket so let's go ahead and do a new flow and we'll call this demo add to watch list and i'll just use that same thing for my description we'll leave in the global app and then we're going to actually run this as a system user so that it'll run regardless of what permissions now i'm in flow designer i do not want to take a tour so we'll skip that i'll add my trigger and we're going to look at an incident being created so i make sure i choose the trigger created and i'm going to go ahead and move my head over here so that's the way it'll get in the way of this as we're creating it uh we'll go ahead and select a table look at the incident table and now i'm going to add a filter so my filter is going to be the company is a certain value so i want to look at the person who's putting in the ticket they're the caller and if i go over and dot walk my way over notice i can see the company that person's in or the department now on your example you're probably going to use department i don't have any departments loaded so i'm going to use company and we're just going to say the company is cross views and that's it that's my condition for whatever an incident is created with a caller's company is cross views we're going to take some sort of action and the first thing i want to do is i want to look up the user record of the person who's going to be added to the watch list so this is real simple we're just going to say look up a record in the user table which is this user scroll down to the use here says underscore user and our condition here is going to be the user id is the person's name so we'll just say my name here since i know i'm in there and that's just going to return one record um i don't want it to return a bunch of records that should return my user record and then once that record is available to me then i can update the record the incident that came in so i choose update record which record do i want to update well i want to update this incident that triggered the flow so i'm going to grab an incident record drag it over here and now i'm going to set the field value of watchlist to that person's that we looked up their user id so i'm just going to scroll down to user id over here on the right hand side and there it is there's user id drag that over the watch list done and i'm done now in reality you need to consider some things like hey maybe i should check to see if they're already in the watch list or maybe you want to look at if someone updates it into it and changes the caller so you may this may vary depending on how you want to implement it but this is essentially what you need to make that work so i'm activating it after i saved it when i activate it that makes it available for me to use so now if i go and actually create an incident in servicenow and set the caller to um anybody who has the company cross view which i just happen to have the company cross views too so we'll just go ahead and uh actually i think i put abraham lincoln um so i might be able to do this abraham lincoln yes good old abe him and i go way back demo of adding to watch list and what we're gonna do is we're going to watch i'm going to save the record and we're going to watch this field right here this watch list and it should update automatically so let's go ahead and save notice my search results opened up there but we're watching this watch list and if my flow worked correctly it should update that value here at some point um so the flow gets triggered in the background and updates the watch list and it should add justin to that watch list i might just need to reload here to see that update and there it is so you see there now justin meadows has been out of the watch list and you don't have to do that manually so this is a great use case of a simple workflow and flow designer that will save you hours of work keep this person who's a liaison for those departments in the loop about what's going on with your tickets have been submitted and help them provide better service i hope you enjoyed this video if you want to learn how to do stuff like this or talk about anything related to workflows give us an email at let's talk crossfuse.com
https://www.youtube.com/watch?v=eErKX8s9qVU