logo

NJP

How To - Configure a bi-directional integration with Jira with integrationHub and Flow Designer

Import · Oct 23, 2020 · video

welcome to our demonstration of the integration hub jira spoke first we need to install the spoke so on the left-hand navigation search for applications under all applications we want to click on all and then once that loads let's go ahead and search for the jira spoke and there it is click install there are the dependencies that are already installed now this process i've sped up quite a bit for this recording normally it will take you a little while and even though it looks like it is finished you need to wait for the close button and there's the close button so let's go ahead and click on that and now the spoke is installed next up we need to create a credential so that we can connect to jira so go ahead and click on credentials and there is the jira entry that was created by our spoke let's put in a username and it says password but we actually want to use an api token so back over to jira under the account settings there is a security section and in there there is a section for creating and managing api tokens go ahead and click on that and let's create an api token give it a label referencing the instance that we are working from click on create and from here we can go ahead and copy it we could also revoke it later from right here so let's switch back to our instance and paste in that api token and update this and now we have a credential for our connection to use let's go ahead and create that connection now so click on connections and we're going to need to make a new one so click on new and we're going to want an https connection so click on that let's give it a name we'll call this one jira outbound because this is the direction we're going to be sending our incidents and the credential is the one we just created connection alias this is referencing the spoke and next up we're going to need a connection url so let's go back to jira and copy the hostname from here copy that and we will paste that into the connection url box and then we're going to submit it next let's take a look at the connection and credentials aliases this is created for us we're just going to go take a look at it now click on jira and here you can see the things that we've created being referenced already it's using basic auth with an api key and here is our connection at the bottom so this all looks good next up let's go put this spoke to use so we'll start off by searching for flow designer and clicking on designer once that loads let's go ahead and create a new flow and we'll give that a name let's call it jira test submit that and the next thing we're going to need is a trigger what's going to cause this flow to start and let's look for an incident being created so we'll choose created and then select the table of incident that's all we need for the trigger anytime an incident is created this is going to start what do we want to do with that information well let's go to jira and create an issue so type in issue that brings up the spoke options and you can choose create issue there the project key this is actually going to use introspection so let's give it a moment it's going to query jira and say hey what are the projects that are available to me and here they are we want the test project now jira also lets you customize what an issue is called and then so let's query jira with introspection again and we can see there that it's called a bug now for the bug we're going to need a summary so open up the incident record that started this process and look for short description there it is and we'll just drag that over for the description let's use the incident description so open up the record find description and just drag that over so that'll create an issue on the juror side that matches the incident on servicenow side so how do we link these two so it turns out that jira gives us the issue back after creating it so let's see what we need to do to update the record to tie these two together we need these to be correlated so we want to start off with the incident record and then let's add a field now what we want to do is somehow use this issue id to correlate the two and it turns out we have a field for that called correlation id so that's the field we want to update let's update it with the issue id this will bind the incident to the bug over on jira so save that and we're ready to activate this once activated any incident that gets created will kick off this flow and we're done let's try it out we'll go to the incident table once we see that let's go ahead and click on create new we'll give it a caller i'll choose ashley give it a short description and we'll just call this one incident from ashley in service now in the description i can just be description from servicenow let's go ahead and submit now if we go back to flow designer you can see that there's a button called executions if we click on that we can see that we have an execution cued if we refresh this a few times we can watch it progress now it's in progress and now it's finished so let's take a look we can see that it was started by the incident being created and it went to jira created an issue and then it updated the original record with the correlation id so let's go back over to jira and see if we can see this new bug i'll refresh the page and there it is incident from ashley and servicenow open it up we can see the title and the description next let's make this bi-directional first let's give jira a way to call back to our instance and we do that with a web hook so search for web hook and open up jira web hook registries and there isn't one so let's make a new one we'll give it a name we'll call this one jira webhook and a token we're going to use the built in token which is jira token but really this can be anything go ahead and submit it and the next thing we need to do is get the url for jira that it's going to use to call this webhook so go back into our record click on callback url and carefully copy this url copy let's go back over to jira go into the general configuration scroll all the way down to the bottom click on webhooks and there they are let's go ahead and create a new one and we'll give it a name referring to our instance and we'll just call it webhook next we're going to paste the url from our instance right into here and we want this to be run anytime an issue is updated so check that go all the way down to the bottom and click on create so that's done anytime a jira issue is updated it's going to call our instance next let's make a sub flow for this and we can see there's one here called process jira web hooks that is the default one that comes with the plugin and we're going to want to make a copy of that so go ahead and open it and let's scroll up and close the and we can see that this default one just does a log so click up here in the menu we'll make a copy of this and we'll call it the demo webhook handler so scroll back up to the top again and we'll close the inputs and we can see that it just logs the interaction so let's go ahead and give it something else to do it sends us an issue whenever it calls the web hook and we're going to make use of that so we'll start by adding a new action and we want to find the incident that correlates with this issue that's being sent over the web hook so we'll choose lookup record and the record that we want is the incident where the correlation id so let's find that matches the issue id and this again is the issue that's passed over when the web hook is called we'll drag the id over and that lookup is finished so this is going to return an incident for us next thing we want to do is update the incident so look for update record and which record do we want to update well we want to update the one that was returned from the previous step the lookup so go ahead and drag that incident over and that will populate the table for us now we want to update the description so look for that and we want to update it with the description from the issue that was passed in so here's the issue scroll down to find description and drag that over and then we're done so we look up the incident and then we update it with the new description go ahead and save this and publish it now we need to tell our webhook handler which subflow to call so let's go back over and this time we're going to open up the routing policy click on that you can see that we've got one that's already in here this comes out of the box and let's update it to call our new subflow you can see here it calls the the default one let's change our scope to the jira spoke open it up leave the name that's fine and we're going to change the answer to be our new flow which was the demo webhook handler click on ok and we'll go ahead and save this now there's one step that we needed to do on the subflow so let's go back now whenever jira calls us it's not actually going to have a user attached and we need to tell this subflow what user to run as so go into the properties and instead of the user who initiates the session we want it to use the system user update this and publish it so now we have a complete setup next let's go ahead and open up ashley's incident again search for incident and there it is and there's the original description so let's go to jira and we're going to update this issue with a new description update from jira go ahead and save it this will kick off the web hook from jira now go back to our subflow look at executions and we can see that it is already run a log it looked up the record and it updated the record so let's take a look here's our incident refresh the page and there's the updated description now this completes our end-to-end flow of the bi-directional integration with jira thank you for watching

View original source

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