ServiceNow Flow Designer REST | Outbound REST in under 5 minutes ?!? | Flow Designer ServiceNow

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to my channel in this video we're going to see if we can create an outbound rest call in servicenow in under five minutes but before we kick off i want to share some big news and that is that this week we hear a hundred subscribers on the channel and that's something i didn't think was possible certainly not this early um which leads me to say a massive thank you to everyone who subscribed so far and all the comments of support it's been brilliant if you are new around here though and yet to subscribe please go ahead subscribe and hit the bell icon and you'll be notified whenever i upload a new video just like this one so back to the main event i'm going to be creating a outbound rest call in servicenow flow designer to see how easy is to configure and the different types of elements i might need to make this work the rest call i'll be making um it's well it's an end point i found it's a free api that i found just on the internet um there's loads out there to play with and i urge you to go and just just just muck about with some i'll drop the um the one i'm using into the description but i wanted to make this a bit more entertaining a bit more interesting than just using like a servicenow e-bonding or bringing back the weather or something that we've all seen before so i'm actually going to try and make service now funny which is perhaps a tall order um but i'm going to use an api which when we call it it should return us a random dad joke when requested who doesn't like that jokes will they actually be funny probably not but we're going to give it a shot um so what elements in service now are we going to play with to get this thing working well surprisingly not a lot so we're going to be using flow designer i've mentioned that um we're going to create an application in the studio which is an effect our spoke we're going to use a rest activity within our action we're also going to use a json pass activity within the action that we're going to create we need to create an acl you'll see what that does um as we go through the video but that's really important we're also going to create a ui action so it's great as creating this action in flow designer but we we want to show that we want to see on screen that hang on this api calls work so what we're going to do is create a ui action on the incident table that when we click it it's gonna call our action that we've created in flow designer via script and it's gonna plonk us the joke on screen on the incident form why would you do on the internet form you probably wouldn't to be honest with you but incident is a table that we've all got in our instances so why not just use it i could have created something else but i didn't so okay let's get started okay so let's do this let's see if we can make an outbound rest call inflow designer and see the results when we click a ui action within five minutes it's going to be very very tight we've got our timer we've got our instance let's go right so the first thing we're going to do is go to studio so we're going to create an application which is in effect it's going to be our spoke so we're going to call it um we'll call it joke it doesn't really matter spelling doesn't matter now okay that's what we're going to do let's go to the application the first thing we're going to do inside the application is we're going to go straight ahead and we're going to go to flow designer and we're going to create our action in flow designer i'm going to call it get oh no why am i doing that get joke okay so we don't need any inputs since it's a very very simple endpoint that we're hitting and we're going to pick the activity of rest now this is great so we can use connection alias if we wanted to but this time i'm going to set it all up manually because i've been to their website the the the endpoint that i'm using and i've got all the information i need so i haven't set up a credential um or an alias so we're going to build it manually we have got a resource path on the documentation on their website they tell us that we need to pass in some headers so one is accept and the other one is user agent it doesn't really matter we're just going to call it user or me get joke um app user agent is just something they want us to to to send them so they know where it's coming from uh okay so we've got our endpoint we've got our method we've got our headers next thing we need to do is we need to do something with the responses coming back now servicenow is giving us this json parser activity which we're going to use which is great because it allows us to put the response body which i have already got here we can put that here paste our little sample and then we can click generate target and what that does is that creates the structure on the right hand side for us so we know what variable or what the variable types are we're nearly at two minutes okay so now we need to get outputs and we need to give this activity an output which which we can then consume so we're going to call it result ah what has it done that result and the type is an object since that's what is on the json path step it's an object here root is an object and i want to get it all object the whole object so i'm going to do this we're going to do that we're going to save oh was that a good idea to save next thing we need to do is we need to make sure this is crucial need to make sure because we're going to run this virus script and not via a flow or a subflow we need to make sure this is accessible and it's client callable so we need to go to manage security but before that we need to set up an acl so we're going to go here we're going to set up an access control now this bit again is quite important and it can catch you out so we need to create an access control and client callable flow object i'm going to give it a name of call action admin overrides we don't need to put a role since i have admin okay so we're nearly there we're nearly there okay let's go back to our action go to manage security select client callable api acls we're going to select the one i've just created put in that update publish go go go go go ah publish okay we're at three minutes 15 are we going to make this we might we've got a ui action to create come on right okay then we go to code snippet and we want to pick the one that's the client side and we're going to grab that select copy code snippet back over to our application we're going to create ui action we're going to do this it's going to be very very tight right you action we're going to call it get joke we're going to do on the incident table because uh why not um we need to make a client callable make it a form button we're going to say on click get joke okay don't let me down function get joke okay and then i that's where i paste in the information i had before but i'm going to remove these bits so it's not self-invoking and it gives us this little red token error we've got 50 seconds left so we just need to resolve that by removing that there and doing that now we need to put the outputs on the form so we're going to do a g form uh what should we do add info message add info message and we're going to make the info message result dot joke so the object that we're getting back from the script is result and the the attribute within the object is called joke since that's the joke itself stop the clock was that fair to stop the clock i hadn't saved we'll save so four minutes 41 seconds has this worked we haven't tested it at all so let's head over to an incident and let's just pick one we should have our ui action oh my thank god we have so if we click this now he says fingers crossed come on excellent right why did the miner get fired from his job he took it for granted right very funny right she would just let's roll the dice once more let's give it another shot we're waiting for the the return journey and the promise to come back uh what's the next joke the other day my wife asked me to pass her lipstick but i actually passed her a glue stick she still isn't talking to me hahaha right i think let's be fair the jokes aren't great right um but i guess what i want to do is prove the the fact that it doesn't take a lot of time to set up um a rest call in servicenow and certainly not one using flow designer and i wanted to show you a few different concepts which i guess what we can do now is we'll step back through what i've done a tiny bit slower just so i can point out the bits that i think are important okay so let's have a look what we did so we created an application um and then we put our flow designer action in that well why did we do that well we did that because effectively what we've done is created our own spoke so if we wanted to create any more actions for this this joke application then they would all sit within the spoke of um joke or get joke whatever i call the application and that's why we did that so if we take a look at the action we actually created so in this case it's a very very simple get all it's doing is hitting an end point virtually note well actually no parameters we're passing in and it's just simply telling us a joke it's just sending us effectively three lines an idea joke and a status there's not a lot to it so we don't really need to send an input we're not sending anything any query parameters across so that's the first thing we don't need any inputs in there we use the rest step which is um servicenow out the box i'm pretty sure it's part of the integration hub which so it comes with a rest step so we're using that so what have we done here connection we've decided to define it in line which means we're defining it on this action itself we could do it via a connection alias again i'm going to do a different video on that i think but we see we can set up cadet connection aliases where you put in kind of the the base url and the authentication and you just access it or select it from the form but we chose to do all on this form we've got the base url we've got no resource path because it's very very simple we're building it manually here's the method again we could play with these but this is a simple get we're using the headers that they've told us or that website told me to use we're not touching anything else we could do retry policies or we could save the responses attachment we've not bothered the other action i wanted to bring your attention is the json path step now this is really really useful um what i could have done is not bothered with the json path step and just output the response object as a string and then handle that within the client script if i wanted to i could have passed that as a json past that and got it the particular joke attribute but i wanted to show you this this is really really useful um and it it gets a lot more useful when you've got more objects or more attributes within the response body coming back so what you do is you essentially select what the res of the source data is which is the response body and when you're doing apis or connecting to an end point they should or typically give you an example response which you can grab that object paste it in here and then click this generate target and it gives you this structure here and it even tells you what type it is so you've got the root is an object and inside that you've got three attributes and they're all strings okay and that's what they look like status joke id so then what we do in the app output is we map our output so we created it called it result we mapped that to um this here to this thing so we said output is equal to root which means that when we when we're um calling this this action we've got access to all this response body um in the type of an object if you look here it's type of an object okay so it's already done that for us so though the rest step and json path step things that i want to call out the other thing the other two things i wanted to call out is when you we can click code snippets so you don't have to run a flow or a subflow to invoke an action you can do it via a script via a business rule a script include or you can do it via a client script um or even your action like we did now at the top here you've got different types um or different code snippets to use server or client now when you click client it's going to say a little message along the top say make sure this action is client callable so just like a script include you got that little tick box we need to do the similar thing for here as well and they'll give you the code snippet and this bits the interesting bit results so this is the the outputs so had i have put more outputs in there it would have given me more outputs to play with here now when i um when i access this from the ui script or the ui action sorry it's this bit it's the result that i want to get and put on screen now i know that's the type of object because it's telling me a type of object and i also know that joke is what i want to access the attribute of joke so we've got a response object and an attribute with inside that called joke and that's what i've got so in order to make this client callable what you need to do and this just be aware of this is click on manage security and we get this client make or callable by client api and that needs to be selected and what you need to do is create an acl just like we did here which then we can apply to that which means this person or this role has access to invoke this action via a client side script now i selected admin overrides um again we could do that and then we could put a specific role in so if you wanted to invoke an action in flow design or viru action but only wanted certain people to do that you could do that at the ui action level to say that only these people can see the ui action but you could equally do it here as well so you can see only these people with the role can um have got access to this acl and therefore can invoke it okay and that that's really important to do as well and last but not least we've got the you action so if we look here again i was very very fast um i might have done this slightly differently but i simply just used the script i had to tidy it up a little bit i think there might be a tiny bit of a bug there actually if i'm being honest um when you have to move if you remember it looked like this and i just had to move that to there okay and this here this is where this is what i was talking about before is where i'm getting the object object dot attribute and that's what we want to display okay so there we have it we have managed to make servicenow funny in under five minutes um we've done it using flow designer we've created an action with rest and the json parser and we've used it and we've called it virus script via the ui action to present that on screen so i hope you've enjoyed what you've seen today um i know it's a bit fast but i wanted to do something quite short and snappy um if there's anything you want me to expand on um that i've shown you today i realized it was quite quick um drop something in the comments below um or if there's any different ideas for videos you want me to do again comments below if you haven't subscribed and you enjoyed what you see please do so um and give me some motivation to keep going with these um hit the bell icon hit like do all the other things that you do on youtube videos and i'll see you next time thanks
Info
Channel: ServiceNerd
Views: 2,765
Rating: 5 out of 5
Keywords: servicenow flow, servicenow flow designer, servicenow flow designer examples, servicenow flow designer rest step, servicenow flow designer rest api, servicenow rest api, servicenow rest outbound, servicenow rest api integration, flow designer servicenow, flow desginer rest step, flow desginer rest message, servicenow json parse step, servicenow flow desginer client callable, flow design tutorial, flow designer servicenow training, rest message servicenow
Id: 9KvNrFdaPlI
Channel Id: undefined
Length: 17min 10sec (1030 seconds)
Published: Sat Oct 17 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.