logo

NJP

4. Flows (workflows)

Import · May 21, 2021 · video

so next we're actually going to create a workflow using the subflow that uses the action that comes out of the box with the integration hub jira spoke so i've got my subflow here i've saved it i've published it so it's available for me to use so let's go ahead and create a new flow or a new workflow within servicenow now my example is going to be create an uh tab to create jira task from a story and in servicenow we have the ability to write stories in the agile application so i'm going to use that as kind of the impetus to create an issue or a task over in jira again we'll keep this in our global application scope and to set up that trigger i want any time that a story is created for it to take this to follow this workflow so go ahead and add a trigger we're going to say record was created and the table that we're going to look at where a record gets created is the story table in servicenow that's rm underscore story and i don't want this to fire in my demo environment when my colleagues are doing demos so i'm going to add a filter and you might want to do this when you're testing and building just to be delivered about what you're doing and i'm going to check the short description to make sure it starts with jira demo uh before i actually do this it's just a way to filter out i could look at any field in the table to do that but this is what i do when i'm just experimenting around or doing demos for people so the next thing i want to do after i trigger is take some sort of action and we're going to call a subflow the subflow that we just made in order to create that issue add the comment and um and log it to service now so i called that demo subflow there we go demo subflow capability now it's going to prompt me for those inputs remember we only asked it for two inputs summary and description and my story has that my story has a short description and a description so because that was what triggered this workflow i have access to that record over here and all the data elements that are associated or related to that particular record so let's go find short description here we go notice i'm not writing any code i'm dragging and dropping short description over next thing we want to grab is the description of the story take that drag it over boom now the summary and the description are both populated so that flow has everything in a subfloor has everything it needs to run now on this particular workflow i might want to do other things one of those things would be to update the story to let it know which issue it's related to so we're going to do an update record action i've got update record and the record we want to update is the story so i grab my story record drag it over and now i can update any field on that story record that triggered this entire workflow so we're going to update the correlation id correlation id is where we store foreign system keys like an issue id from jira i know that when i run this flow that when it creates the issue i'm going to get into id back that's right here on the right hand side coming from the subflow so i've got that data element that i can pick up and drag over and drop and now that'll populate the correlation id within servicenow the other best practice thing to do is go ahead and configure the correlation display so that we know what that id actually relates to we're just going to call it jira so this is how in servicenow on any table when we're linking to external or foreign systems we use correlation id and correlation display to tie the two things together think of it as foreign key and what that foreign system is okay so now it's done we've added our issue id and our identifier the next thing i want to do is on the story record i want to say hey the issue has been created in jira or a task keep saying issue so we'll go ahead and we'll do a comment so we'll talk a little search for comment and it will pull back i'm actually going to use add work note because i don't really want this customer visible so we'll add work note and we're going to do it on the story records again i grab my story record drag it over that's the task i'm going to update and then we're just going to say task and then we'll do the number has been created in jira so on the servicenow side if someone creates a story it's going to create the task in jira we're going to update the task and then we're going to add a work note to the story that the task has been created so let's go ahead and save this we're going to activate it and then we're going to test it okay so now i'm in the stories module of servicenow and what i want to do is create a new story so that it will trigger that particular workflow so if you remember we wanted to add jira demo to our short description in order for the workflow to fire since i don't want this firing just you know when we're doing regular demos uh but we'll go ahead and put in a small short description there for mr roosevelt and put in some further text and that's enough for me to be able to save this form and while that's being saved i'll call your attention down here to the work notes so part of our flow look at how fast that actually happened we've got task number one zero zero four one that has been created in jira so we know our workflow is working and let's go take a look at jira and see what happened over there there it is so there's jira demo roosevelt's main in the arena i've got my long description that i added in a particular story so that got copied over and i've got my comment saying this was the task created by servicenow and now jira and servicenow are in sync so now you've seen how we can use your integration hub jira spoke to take advantage of flows subflows and actions within servicenow to do things in the servicenow platform and to do things in third party applications

View original source

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