logo

NJP

ServiceNow - 3 useful UI Actions every developer needs in New York

Import · Apr 19, 2020 · video

hello my name is Jason Miller and founder of asthma now solutions we're about to unlock the power service now but to start off by thanking all twenty nine hundred and ninety five subscribers and over 80 countries globally if you believe in transferring knowledge to those who need it most please click Subscribe your user data will not be transferred to anyone outside of Aspen now without your consent well welcome back friends know that in the world a lot of crazy stuff is going on but I know that here in Florida some of the beaches are starting to be open back up so that's good news and just wanted to you know send a message show you guys that are playing service now out there how important your jobs are and you know you should should really be proud of yourselves that you're in the technology sector and playing this wonderful platform so today what we're going to talk about is three useful user interface actions or UI actions more commonly referred to as that will be really useful for you and I think will be awesome to have in your arsenal and I've used these in the past with with different customers and you know fulfilling their requirements and so forth so when you think of a user interface action for those of you who don't know what a UI action is it's basically I want you to think of two words or two terms one is button and the other is on demand so usually on your screen you'll see like a button and I'll show you in just a second the three that we're about to talk about today so the first one is copy record the second one is the copy or excuse me create a child task and the third one is to create a user the third one it could also be an assignment group in addition to a user or maybe another record in the system that is not related to either the current table or the child task so let's take a look at this table right here is called Aspen record producers you're quite familiar with it if you've watched all my previous videos right now what I'm going to do is I'm going to go into the forum and we'll see here that I already have the create users button right here this is the third one yeah the third one that are referred to and I'm going to show you the other two and then first I'm going to show you how they work and then we're gonna go and take a look at you know how to set these out so I'm gonna show my fill in the mandatory field here now myself and I'm gonna put in a couple other things at the short description with my initials and then I'll just put it in JM one for the description here and I'll give it a request urgency of this and I'm just gonna hit save right now so the first one that I'm going to demonstrate is this one called Aspen copy which is essentially are a copy request I just named it Aspen copy I want to put my own personal branding on it so what this is going to do is going to copy the record so we'll see here one is a 108 seven is our current record so when I hit Aspen copy I will notice that it didn't come up in the in the new screen correct so if I go to a new one the only one we're gonna see up here is create user and I'll get to like how we set that up one is for on insert and then the others will be for update so this is what we considered the update after the record has been created or inserted into the table so at this point I'm going to click on a snow copy and it should copy over a couple things and go request for or urgency short description and description so go ahead and I think I did location 2 so let me just add my location here I'm just gonna save it one more time now I'll click Aspen copy and now we're gonna see here look a new record is opened we have our number here that has changed at 108 nine and let's see here it looks like the the requester came through the location came through urgency short description description just like we wanted and now I'm gonna go ahead and click Save so that demonstrates the first one so if we want to take a look at the nuts and bolts behind it we'll take a look at copy record and we'll go here to our UI action so to create a UI action we're gonna go to the sis UI action table to get there we would type in this UI action and then you could do dot lists to bring it up in a new tab or a new window excuse me in a new tab not a new window and then we'll see here the name is Aspen copy and that's what's gonna go on your button label right see how show insert is not checked but show update is that's why on the update it was displaying and not on the original and then I made it a form button I also made it a form link so you have a couple of options here as to where you want to put it also I want one thing I wanted to know is like if you're doing agent workspace and you're banging your head against the wall so why it's not showing you have to go down here to this section called workspace and you have to add them that way it's also another section here to requires role so if you want to make it only for admins maybe I told Adam ins whatever this is where you would go ahead and do that and then here's the script right so we're gonna notice here our current or condition is open by has to equal the user so I'll show you I'll prove it to you just like in a second that only that specific user can see it regardless of whether I'm an admin or not so that's what we're saying there like you have to be the first one to open this record to make a copy of it so let's break this down we declared a variable copy one we're saying glide record the Aspen RP table which is the same table right so if we take a look here Aspen RP we find it right here in the URL now that's our that's our table name and then I'm just telling it look set the value of requester to requester right and we'll notice here the society remember I talked about this in previous videos that if you are having trouble with reference fields always go you're go to play it is to do dots this ID to make that populate because if you don't have dot society it's not going to populate so then we have here the other ones so location I also did dots this ID and then the other ones like urgency which is a string with choices and then these other chip which are strings I just did current dot and then their field name right so pretty straightforward and then we'll notice why does it open a new window right here sees action dot open and glide record and then we refer to copy one which is our variable up here so that's what makes that happen I looked at some of the other UI actions are out of the box and they're just really complicated I think this is a much simpler method for creating a UI action because all the other ones that I found out of out of the box were they always inevitably they always refer to like some script includes or there's some you know long if statement you know that's convoluted and confusing I think this is just way simpler of a method to use or script to use to implement this so you know you're feel free feel free to use it that's what this channel is there for right so let's go back here and let's prove it that's I can't open one that was done by another user right or opened by another user so well find here one was open by Bill Gates it's like for Kovan 19mm and then we'll see here assman copy is not there so it looks like that condition is filtering this out so that's great now we'll talk about the second one which is copy or going to create a child task so I'm gonna go back to the one that I just created which is 108 nine and now I'm going to click on create child task all right and we'll see here it runs this little message almost looks like a business rule it says Aspen tasks blah blah blah has been created now what's happening here here's our number and by the way with these numbers you should probably never leave them like open like this should probably have a UI policy or some sort of data policy that covers these uh or makes them read-only so for our parent record it inserted the number here right it's not great so if we want to refer back to it we could we know like where where this is coming from right or how this was created and look it gave us it automatically populate the assignment group so let's go and break this one down that's our create child task and the reason I created these tabs is also like if you need to come back to the video you can see where I'm clicking and then just fast forward there so that way it off the waste your time so again we'll see here a show update name of this create child task table name remember the table name is where it's coming from right that's what we want the button to be even though we're creating this on a different table so what do we have here we have a variable of ask a SP and then the glide record is going to the task table right and then we're saying ASP meaning this table short description we want the short description to be the same as current current refers to this table right here right that short description and then I put in some other stuff like parent is current that's this ID meaning put in that parent field the sis ID of this record right here at the table and then we have our assignment group it's always setting it to Aspen now I put in the sis ID of that assignment group and we saw that it worked perfectly there and then we're saying ok variable sis ID ASP insert right so insert the record and then the parents equals society for the parent field right so if we want to also put in the parent fields that way we can do that too and then here's where that info message is coming from right Aspen tasks a spot number has been created and then we're redirecting it to we're redirecting it to that that's hats that we just opened up and then we're setting the return EOI current okay cool so now we got all that out of the way and we saw and again just as a reminder for the workspace if you're gonna put on agent workspace you have to do it down here and then requires roles you know right there all right so then we'll take a look at our third one all those our third one here oh yeah that's right create the the user so basically there are times when you know you might have someone ask you hey you know what I need is the ability to create a user from a record like if I can't find them right here on the requester I need to be able to create one so here's what I want you know like here's $100 to create me a button where I can just create the user and you'll see here create user is here on insert right so let's say I couldn't find the requester I create a UI policy to basically hide the requester and they create a new one now so I'll put in a user ID right so if I want to add here that the user ID that'll go into the user table I can go ahead and do that right now so let's say I want to put in I don't know if it's a person that I'd want to put in there let's just put in here Steve I don't know let's go Ballmer now let's go with jobs let's go Steve Jobs I'm going to do sorry I meant to do Steve Jobs and then here I'm going to do Steve and then I'm going to do Jobs is the last name and then I'm gonna do Steve Jobs at APL com great and now what I'm going to do is I could save this but what I'm going to do now is create user alright so runs the business rule telling me that congrats blah blah blah and then we're gonna have an account for Steve Jobs and create a message also right here and also it takes me to the record so right now we'll see that we're looking at the sis user table and also one thing I did was I wanted to track these things so I created this created from field so that way I know that this came from an aspen RP or record producer record so that way I know that so I can track it that way too if I wanted to go back to that record I always you know I could do that if I wanted to later on to kind of trace this so let's take a look and break this down so here's our create user UI action right here we'll see here show n serve was checked which means that when I go to a new record the create user will display and again the other the show update is there too so later on it'll be there and we'll notice like on the last I didn't have any conditions there I kind of just put the conditions in the comments so that way okay so I want to pop it in there later on I could so what are we doing we created the variable or declared the variable ASP we have our sis user record then we're going to do you know dot first-name equals current that first name because here this is coming off of which table this is coming off of the Aspen RP table so we have the same thing with the last name and that's why you have this you underscore yours because that's a custom field whereas on the user table itself these are all out of the box so we have email to you email etcetera and on down the line and then here we have our variable Society ask that answer and then here's where that info message came from and this is kind of just like the last one right have the info message that pops up at the top and it redirects us to that that record and then one other thing was that this created from notice current that society right so current being you Aspen R P dot society so those are the three UI actions that just reviewed and again I've used these in the past and I think they're they're really handy so if you ever want to refer to this video and if you learn something today just go ahead and click like my name is Jason Miller founder of Aspen out solutions and we just unlocked the power of service now

View original source

https://www.youtube.com/watch?v=8KfDsTdU5aE