The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Sravani44
Tera Contributor

Pre Requisites:

IntegrationHub Subscription

What the Jira Spoke does?

  • Issue Management
  • Project Management
  • SDLC Management
  • User Management
  • Group Management
  • Metadata retrieval
  • Sprint Management
  • Utility Actions
  • WebHook Management

Retrieves Jira data to use in a flow.

Jira Spoke provides a concept of Bi-directional webhooks that notifies about the events occurred in Jira for example. updation of an existing issue, when an issue is assigned to a particular user etc.

 

Bi-directional WebHook:

This has 2 modules:

  • Jira WebHook Registries(these are used to assign a token and API path. We need to generate a call back URL from here and provide it in Jira)
  • Jira WebHook Routing Policies(these triggers the subflows based on the conditions specified)

Note:

  • ServiceNow provides a default routing policy which needs to be modified according to the requirement.
  • Jira Spoke provides a default subflow to process the WebHook events

 

Integration Steps:

 

Step -1: Setup Credential in ServiceNow

  • In ServiceNow Instance, Navigate to Integration Hub > Credentials
  • Click on “Jira” the entry created by the spoke. Provide the username and for the password, go back to Jira and in Account Setting> Security> Create and Manage API token>Create API token
  • Give a label and click on “Create” and “Copy” the token.
  • Switch back to ServiceNow and paste this token in “Password” field and update this record.

Credentials has been setup

Step-2: Setup Connection in ServiceNow

  • In ServiceNow Instance, Navigate to Integration Hub > Connections
  • Click on “New” and “HTTP(s) connection”
  • Provide a random Name in the “Name” field. Select the credential that we have selected in step-1 in “credential” column.
  • Connection Alias is referencing the Jira spoke. So select the Jira spoke in this column.
  • Connection URL is the hostname of the Jira application.
  • Click on “Submit”

 

Step-3: Check Connection and Credential Aliases

  • In ServiceNow Instance, Navigate to Integration Hub > Connection & Credential Aliases.
  • Click on “Jira” and check that credentials and connections are interconnected with each other.

 

Step-4: Create a Flow Designer

  • In ServiceNow Instance, Navigate to Flow Designer > Designer
  • Create a new Flow-Give a name and Submit
  • In the trigger, create a trigger condition like when this Jira integration needs to be triggered.
  • In the next step – Actions, Create a new action- Search for “issue or Jira” and click on “Create an Issue”
  • Provide Project Key, Issue Type and Summary, Click on “Done”
  • For correlating these two, Jira provides back some parameters. Here we can use Issue ID and map that to the record(incident or task etc..)
  • For mapping the Jira Parameters to ServiceNow record, as the next step in Flow Designer, create an other action “Update Record” and map the respective fields or add the parameters to the worknotes etc.

So Jira Setup is now done 

Test this

Step-5: Make this Bidirectional

  • To make this Bi-Directional, we will create a webhook in ServiceNow.
  • For creating a webhook, navigate to Jira Webhooks> Jira Webhook Registries and click on “New”
  • Provide a random name in “name “Column and Select the built-in token i.e. Jira Token in the “Token” column
  • So next thing is to get the callback URL for Jira to talk to ServiceNow.
  • To do this, go back to webhook registry that we have created and click on “callback URL”. Copy the URL from the information box.
  • Now go back to Jira and open General Configuration and open Webhooks.
  • Create a new Webhook in Jira Application (Specify random name and paste the URL copied from SNOW into the URL field). Also please check when the issue is update checkbox. And click on “Create”
  • Now go back to ServiceNow instance and create a subflow in flow designer.
  • There is a default subflow “Process Jira WebHook”. Make a copy of this subflow
  • In the subflow, create an action “Lookup up Record” and find the incident where correlation id is issue ID
  • Create another action for updating the record. For example, update the worknotes with the resolution or description etc. sent from Jira.
  • Now we are going to tell webhook which subflow to be called

 

Step-6: Create Jira Webhook Routing policies

  • There is a OOB decision. Update this with the sub flow that we have created.

 

Please do mark helpful and bookmark if possible. Thank you for reading.

Comments
Steven Slocum
Tera Guru
How would we handle multiple webhooks? If we have different situations in jira, that once posted to Servicenow we want them handled in different ways, how can we specific the correct subflow? Is there a way to query which webhook from the registry was triggered? Or the name of the webhook from within Jira?
Ben69
Tera Contributor

Is there any additional information on how to set this Spoke up with an on-prem Jira server? 

Laura_Diggs
Giga Guru

You will need to use a MID Server for an on-prem Jira server. In your Connection record, there should be an option to select 'Use MID Server', then you can decide whether to specify a specific MID Server or allow the system to auto-select one.

I believe you'll also need to setup a username/password pair in your Credential record (vs. a cloud instance where the Password field is actually set as the API token). Make sure the account you use for this Credential has the needed permissions in your Jira instance for the activity you're trying to complete or you'll get some misleading error messages.

Eirik Jordheim
Tera Contributor

@Steve Slocum Did you find a soultion for multiple jira webhooks? 

Steven Slocum
Tera Guru

Yes actually. It a combination of unique Webhook Registry records inside SN, and modifiying the rest API codes for each.

1) Create multiple Webhook registries. Make sure you modifiy the path field so they are all slightly different. If I was doing something regarding Jira Project Creation, my Webhook Registry name would be "JIRA Project Creation" and my path might be "api/sn_jira_spoke/jira_webhook_callbacks/createProject"

2) Leave the JIRA Webhook Routing Policies table & records alone. We will basically ignore this in the next step.

3) Go to the Scripted Rest API section within SN, and find the record with API ID of "jira_webhook_callbacks"

4) You'll see 1 resource record called "Default Callback" in the related list at the bottom. The resource path is the same as the default JIRA Webhook and all the script is doing it manipulating the flow inputs and choosing the run the subflow listed in the JIRA Webhook Routing Policies table. We can leverage whats happening here to force it run our own unique subflows based on the resource path.

5) For each of your unique Webhook Registries/Paths you created in step 1, copy the Default Callback Scripted Rest Resource Record, modifiy the name and update teh resource path field to be the same path from your Webhook Registry. Clone the existing JIRA subflow and make your edits specific to each desire of the webhook. In your Scripted Rest Resource record, in line 38, replace "subFlowName" with the actual back-end name of the new subflow you want triggered. Do this for each Webhook.

 

This is a long winded answer but the point is to just create and manipulate the Rest API. We provide a webhook to Jira, when Jira sends the webhook back, its intercepted by the specific Rest API looking for that webhook, and our script forces it to run the subflow that we selected for this situation.

find_real_file.png

find_real_file.png

 

 

J-Monta
Mega Explorer

Hey, in case you didn't know Exalate.com it way more flexible solution to integrate Jira and service now bidirectionally, take a look ServiceNow - Exalate Documentation - Exalate Documentation (idalko.com)

AyaanPruitt
Mega Explorer

Hello, guys. HUGE thanks for your help on that!! My team and I have recently started working in Jira, so it will take us some time to figure out all its features. That’s why we’re really grateful for your help with that. Btw, we’ve already found a way to connect Tableau to Jira (found it on newsupdate.uk). Tbh, Jira is the best thing that has happened to us recently. We’re happy that we have finally moved to it from Trello. Jira definitely has more functions. Keep the thread updated. Thanks a lot!

Akash Singh2
Tera Contributor

@Sravani44 ,

Hi Sravani,

I have followed the steps as given in the article by you.

I am able to create issue in JIRA but when i update issue in JIRA, its not updating the incident in servicenow.

I have checked webhooks callback URL. it matches as given in servicenow instance.

can you please guide me what could be possible reason and how to dubug.

Thanks

Akash Singh

Version history
Last update:
‎01-27-2022 10:14 PM
Updated by: