logo

NJP

2. IntegrationHub Spoke Action (pre-built)

Import · May 21, 2021 · video

so to get started looking what an action is and how it works i wanted to use the example of a rest call a rest call is something we do frequently with integrations to get information from other systems or send information to other systems i'm going to go over this create issue action that's in the jira spoke if we have the ability from servicenow to create an issue within the jira application and i'm accessing that from studio which is opening up flow designer flow designer is where we configure a lot of these integrations now an action has three main components there's inputs there's some steps in between what to do with those inputs and then there's some outputs we use an action in our subflows and our flows in order to take some sort of action and process data in this example we're going to create an issue within jira so we need to make a rest call to the jira instance and do whatever we need to do to create that and then jira is going to send us information back which we'll send as outputs back to our workflow so they can be used elsewhere in the workflow but regarding inputs this one's pre-configured servicenow maintains this one and you'll see when we use this action we can provide the jira project key a summary a description of the issue what the issue type is the assignee for the issue the priority any labels we ought to add to it the update history and then the parent issue or parent key for that particular issue that we're creating now if you look just above my head not all of these are mandatory so some are going to be required when this action is used and some won't be required so we have that capability notice that when we were defining these if we had created this one we can specify what type of information we're expecting in these fields so i've got strings i've got choice data where they got to select something true false any kind of data types that are supported by servicenow they can configure this input step next is to actually configure the payload we want to take those inputs and create an actual payload to send a service now with the jira spoke they use a script to make that happen so they store all these inputs into variables and then using those variables they build the actual payload that's going to go to jira in order to create that issue once that payload's created we're going to output it as a variable to this particular action so that the next step in the action can use this payload and actually send it to uh to it jira so that's the next step we're going to create an issue using the rest api for jira i have some connection details that we're storing in servicenow i have some request details this one happens to be built manually but i got the rest endpoint we're going to do a post request here's my query parameters the update history some headers and what content how i want to send that and receive that and then the payload here in the middle the request content so this is going to be in the body of our request that we send when that comes back when we receive a response hopefully a successful one from jira we have a script to handle that response if there's any errors whoever coded this made sure there's some error handling involved so we're taking as input the status code and the response from that create issue rest up and then we're running a script to assemble or extract to parse out what that particular error was and then make sure we send the correlation issue id the error message and the status to the workflow that called this particular action so that leaves us with our last part the outputs we're going to send status the error message if there was one and an issue id back to whatever subflow or workflow called this particular action so we received information the beginning we processed it made a rest call and then we're sending information back to our workflow

View original source

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