ServiceNow JIRA Integration for Cloud

1. Introduction:

Many companies use Service Now and Jira for their different teams for different purposes. Many times, the engineering and product teams use Jira, while the customer support and operations teams are on Service Now. This plugin is designed to bring these two disparate systems together. This plugin allows for seamless bi-directional sync between ServiceNow incidents and Jira issues.

2. Plugin Installation:

Go to Atlassian Marketplace and search for “JIRA ServiceNow Connector”

Step 1: Log in as a JIRA administrator. Go to → Jira Settings → Apps → Find new apps

Step 2: Find the "ServiceNow Connector for Jira on Cloud" and click "Install."

3. Overview:

Figure 1: Create issue from Jira and Update the issue from ServiceNow/Jira

 

Use Case to check this application

  • If a user creates an issue in Jira then the plugin will create the corresponding incident in service now

  • It syncs all values from Jira Issue to ServiceNow incident including component, reporter, assignee, custom fields, attachment, and comments based on the mapping of the fields.

  • If user updates incident in Jira then the plugin updates the same values in the service now.

  • It links the Jira issue key to the ServiceNow field and ServiceNow incident number to Jira Issue.

  • Users can easily track changes and sync between two different systems using this seamless integration.

Note : Similarly user can create incident from ServiceNow to Jira, and updates can flow from Jira to ServiceNow OR User can create and update issues from both the applications.(ServiceNow and Jira)

4. Configure the plugin in JIRA:

Connection Configurations

Step 1: Go to the installed application and click on the “Configurations” link in the top right corner.

 

Step 2: Select the connection type in the connection form.

 

Step 3: Now enter your connection details for the ServiceNow instance in the “Connection Form.” Don’t forget to test the connection using the “Test Connection“ button before clicking on the “Save Connection“ button to finally save the connection details.

Your Basic connection details include the following:

  • ServiceNow URL - The ServiceNow instance URL provided by ServiceNow

  • Username - ServiceNow Instance username.

  • Password - ServiceNow Instance Password.

 

Your OAuth connection details include the following:

  • ServiceNow URL - The ServiceNow instance URL provided by ServiceNow

  • Username - ServiceNow Instance username.

  • Password - ServiceNow Instance Password.

  • Client ID - ServiceNow Instance Client Id.

  • Client Secret - ServiceNow Instance Client Secret.

Integration User Configurations

In order to push the updates from ServiceNow to Jira, we need a Jira account under which the updates will be pushed. We call it an integration account over here. The user can enter the Jira account id of the integration user account in the plugin so that the plugin identifies the updates made from ServiceNow to Jira and skips the process to update ServiceNow, thereby preventing a duplicate entry in ServiceNow from Jira. Note that it is not mandatory to add this account. Leaving it empty will send all the valid updates received by the plugin from JIRA to the configured ServiceNow instance.

Step 1: Click on the “Configurations” link in the top right corner, and you should see a form for the Integration User. Remember, this form only gets enabled if you have saved ServiceNow configurations. Otherwise, please save the connection configurations first before trying this step.

 

Note: If you are not able to connect to ServiceNow, then please check the user and its roles.

You need below users and roles to connect to ServiceNow

  1. Admin user:  Any ServiceNow admin user (Just for testing and not recommended for production)

  2. Integration user: Create an integration user or any user in ServiceNow and add below roles

  • itil

  • personalize_dictionary

Step 2: Enter a valid Atlassian account ID for the user, which is used by the service now to update Jira, and click on "Save.”

Select Preference Configurations

To have control over the create and update functionality, we have introduced this select preference checkbox feature. Using this feature, we can control the events on which the data is sent over to ServiceNow from Jira.

Step 1: If you only want to create the incident in ServiceNow, you can leave the update checkbox empty. Check the Create checkbox and click on save.

 

Step 2: If you only want to update the incident in ServiceNow, you can leave the Create checkbox empty. Check the Update checkbox and click on save.

 

Step 3: For synching on both create and update events, check both the checkboxes and click on Save.

 

Select Attachment Preference Configurations

To have control over the create and update attachment functionality, we have introduced this select preference attachment checkbox feature. Using this feature, we can control the events on which the attachment data is sent over to ServiceNow from Jira.

Step 1: If you only want to add attachments while creating the incident in ServiceNow from Jira, you can leave the Update Attachment checkbox empty. Check the Create attachment checkbox and click on Save.

 

Step 2: If you only want to add an attachment while updating the incident in ServiceNow from Jira, you can leave the Create Attachment checkbox empty. Check the Update attachment checkbox and click on Save.

 

Step 3: For synching on both create and update attachment events, check both the attachment checkboxes and click on Save.

Custom URL configuration

Step 1: Choose the ServiceNow table either Incident or Change Request

Step 2: After selected the table, Click on the save button.

 

Step 3: Enter the test connection endpoint URL and click on save. After saving an test connection endpoint, It will take an custom test connection endpoint URL otherwise it will take default one.

Step 4: Enter the get field endpoint URL and click on save. After saving an endpoint, It will take an custom get filed endpoint URL otherwise it will take the default one.

Step 5: Enter the create endpoint URL and click on save. After saving an endpoint, It will take an custom create endpoint URL otherwise it will take the default one.

Step 6: Enter the update endpoint URL and click on save. After saving an endpoint, It will take an custom update endpoint URL otherwise it will take the default one.

Step 7: Enter the attachment endpoint URL and click on save. After saving an endpoint, It will take an custom attachment endpoint URL otherwise it will take the default one.

Step 8: Enter all the endpoint URL’s and click on save. It will take only custom endpoint URL.

Failure Logs


In any failure occurs in the process, user will be able to see the logs in failure logs. Some sample scenario's are mentioned below,

Step 1: Click on the “Failure Logs“ link in the top right, it will show the failure logs list.

Step 2: While creating an issue, if some fields are missed in mandatory field mappings, then failure log will occur. In “Failure Logs” the reason for failure will shown (“Mapping validation failed while creating incident“).

Note: In a Jira issue, SN Number and Sys Id will not appear if failure occurs.

Step 3: After failure occurs in failure logs, add the missing field in field mapping and click on the Retry button on Failure log then it will create an incident on ServiceNow. The SN Number and Sys Id will shown in the Jira issue also. After clicking, a retry log will be successful, and it will delete the particular failure log.

Step 4: While updating an issue (description or summary), if some fields are missed in mandatory field mappings, a failure log will be generated. In “Failure Logs,” the reason for failure will be shown (“Mapping validation failed while updating incident“).

 

Step 5: After failure occurs in failure logs, add the missing field in field mapping and click on the Retry button on the failure log; then it will update an incident in ServiceNow. After clicking, a retry log will be successful, and it will delete the particular failure log.

Step 6: While updating a comment in an issue, if some fields are missed in mandatory field mappings, then failure logs will be generated. In “Failure Logs,” the reason for failure will be shown ("comment Invalid mapping found for update“).

 

Step 7: After failure occurs in failure logs, add the missing field in field mapping and click on the Retry button on the failure log; then it will update an incident with a comment in ServiceNow. After clicking, a retry log will be successful, and it will delete the particular failure log.

Step 8: While updating an attachment in an issue, if some fields are missed in mandatory field mappings, then a failure log will be generated. In “Failure Logs,” the reason for failure will be shown (“Mapping failed while updating attachment“).

 

Step 9: After failure occurs in failure logs, add the missing field in field mapping and click on the Retry button on the failure log; then it will update an incident with an attachment in ServiceNow. After clicking, a retry log will be successful, and it will delete the particular failure log.

 

Fields Mapping

Step 1: Click on the “Fields Mapping” link in the top right and select the project, issue type, Jira field, and Service Now field, then click on the “+” button to save the mapping.

Note: Please refer to the below mappings between the Jira field and the Service Now field. These are the “Mandatory” field mappings that are required to get the sync up and running. We need to Create two fields in Jira “SN Number“ and “SN SysId“ to capture the ServiceNow incident details

 

Note: If a Jira field that we are trying to map is a field that can have predefined multiple values, like a drop-down or a multi-select, then the plugin will open a dialog where you can map individual options. Please refer to image below

 

Note: All the mappings for Jira fields like drop downs and which require individual value mappings like about will have an eye icon in front of the “Delete“ link in the mapping table (please refer to the image below). You can use this icon to view or change the mappings. It will open up the same dialog box as above.

5. Configure Jira for Synchronization

This configuration is needed to support real time sync from ServiceNow to Jira. Please contact us at atlassian@empyra.com . Scripts are developed in ServiceNow to push the changes from ServiceNow to JIRA

5.1 Configuration

  • Configure outbound rest message

  • Create business rules to push data from ServiceNow to JIRA

Configure outbound rest message

  • Name : Enter valid of outbound rest message

  • Description: Description of outbound rest message

  • Endpoint : URL of your Jira application

Note: If Jira is behind the firewall, you can add mid-server details .

Step1: Create the Outbound Message


Step 2: Create HTTP method to Create Issue:

As shown in below screenshot, Click New

  • Name: Enter any name

  • HTTP method : Select POST

  • End point: Enter the Jira endpoint for issue Create

 

5.1.2 Create business rules to push data from ServiceNow to JIRA

  • Give name of Business Rule

  • When to run : Enter when to run it

  • Actions : Set your field values

  • Advanced : Write script

Click on Advanced Tab-> Enter the update script ( Please refer the sample script to update the fields from ServiceNow to Jira Cloud)\

//This code is used to create Jira Issue from servicenow (function executeRule(current, previous /*null when async*/ ) { try { // Add your code here var request = new sn_ws.RESTMessageV2('10_CloudJiraIssueSync', 'create_cloud_issue'); request.setRequestHeader("Authorization", "Basic "+Base 64 token); // Base 64 token can be generated like this ${Email}:${API Key} var sourceData = "JiraCloudServiceNowIntegrationCreateIssue"; var jira_issue_id = "10020"; // Jira issue type id we can get it from Jira var jira_project_key = "CUS"; // Jira project key we can get it from Jira var incident_number = current.number; var incident_sysId = current.sys_id; var incident_short_description = current.short_description; gs.log("The incident_short_description" + incident_short_description, sourceData); request.setEndpoint(request.getEndpoint()); gs.log("##The End Point :" + request.getEndpoint(), sourceData); var currentIssueKey = current.u_jira_issue_key; var currentDescription = current.description.replace(/\n|\r/g, " "); var currentShortDesc = current.short_description.getDisplayValue(); var requestBody = { "fields": { "summary": currentShortDesc, "issuetype": { "id": jira_issue_id }, "customfield_10033": incident_number.toString(), //this is the customfield from Jira we have created to store the number "SN NUmber" "customfield_10034": incident_sysId.toString(), //this is the customfield from Jira we have created to store the sysid "SN SysId" "project": { "key": jira_project_key }, "description": { "type": "doc", "version": 1, "content": [{ "type": "paragraph", "content": [{ "text": currentDescription, "type": "text" }] }] } } }; gs.log("The request body :" + JSON.stringify(requestBody), sourceData); request.setRequestBody(JSON.stringify(requestBody)); var response = request.execute(); var httpStatus = response.getStatusCode(); var httpResponseBody = response.getBody(); var responseObject = JSON.parse(httpResponseBody); gs.log("The Response Body #:" + httpResponseBody, sourceData); current.u_jira_issue_key = responseObject.key; current.update(); gs.log("####END OF INCIDENT UPDATE####", sourceData); } catch (ex) { var message = ex.message; gs.log("The error message " + message, sourceData); } })(current, previous);

 

Note: You can reach out to your ServiceNow team to configure the above steps in ServiceNow. If you need our help, you can reach out to us for paid professional services (atlassian@empyra.com).

6. Configure in ServiceNow for Synchronization

Below configurations are needed to support real time sync from Service Now to Jira. Please contact us at atlassian@empyra.com . Scripts are developed in Service Now to push the changes from Service Now to JIRA

Field Support for Incident

Field Label

Field Name

Type

Field Label

Field Name

Type

Number

incident.number

string

Short description

incident.short_description

string

Description

incident.description

string

State

incident.state

choice

Additional comments

incident.addedComments

journal input

Assigned to

incident.assigned_to

reference

Assignment group

incident.assignment_group

reference

Caller

incident.caller_id

reference

Category

incident.category

Choice

Impact

incident.impact

choice

Priority

incident.priority

choice

Urgency

incident.urgency

choice

Problem

incident.problem

reference

Work notes

incident.work_notes

journal input

Work notes list

incident.work_notes_list

list

…..

….

Note: All fields of Incident table. Provision to map the field values in Jira

 

7. Other features

Filtering :You can use filter dialog to filter the mapping records based on project, issue type and Jira field. in order filter the records please follow the following steps

Step 1: Click on the filter button besides '+'(add field mapping) button to open the filter dialog

 

Step 2: Select project(if you want to filter the records in the mapping table by project alone), issue type(if you want to filter the records by selected project and selected issue type) and Jira field (if you want to filter the records by selected project, issue type and Jira field).

Step 3: Click on “Set Filters“ button to filter the record in the table based on the selected values

Step 4: Now you can click on 'X' at the top right corner of the dialog to close it and see the filtered records. You can close the dialog by clicking on anywhere else on the screen too.

Note: You can clear the filter by clicking the ‘Clear Filters' button. Please remember that filter will remain applicable unless you manually clear them by clicking the 'Clear Filter’ button in the filter dialog or refresh the plugin page.

 

Change Number of records per page : You can change the number of records per page by selecting a different value for “Mappings per page“ in the filter dialog.

Note: Clearing the filter will not reset the value for “Mappings per page”.

Typeahead project field : The project selection field is a special Typeahead field both in the field mapping form above the mapping table and the filter dialog. In order to work with it you need to enter the first three characters of the project name and the field will populate the names of the project matching the search.

Pagination : You use the pagination links below the mapping table to navigate through the records in the mapping table.

View System Logs : You can view the logs generated by the system in last 30 days for your Jira instance using this option. in order to view them please follow the below steps,

Special case of description field: We consider the mapping for the description field between Jira and service now to be special. You can map multiple Jira fields to the description field in service now. Whenever this is done, the content of the description field in Jira will be put below a separator ('--------------'), and all the other mapped values will be put above the separator. We recommend that you configure this behavior if you have a field in Jira for which you do not have any service-now equivalent field but you still want to have that value somewhere in service-now.

Step 1: Please click on the COG icon in the top right corner of the screen and then click on 'View System Logs'

Step 2: This should open up a popup box with system logs in it. You can scroll through the entries to see the operations listed over here. While reporting for any issue you can copy and paste these lines of logs so that we can identify if the issue is with how the process is followed or if there is really a bug in the system.

Delete My Data: You can use this option to clear your mapping data and the connection configurations.

Note: This operation will not delete or touch your data in Jira. It only clears the mappings that you have created in the plugin along with configuration for service now

Steps 1: Please click on the COG icon in the top right corner of the screen and then click on 'Reset Settings'

Step 2: This should open up a pop for your confirmation to delete the settings. You can click on the “Confirm” button to delete the settings, or you can cancel the operation by clicking on the “Cancel” button.

6. How it works:

Step 1: Follow the above steps to create configurations.

 

Mandatory mappings could be as follows,

Step 2: Create an issue in Jira then enter the project, issue type and all mapped fields like summary, description,

 

Step 2: Click on issue which you created and check the Service Now Id and Service Now incident number custom fields. If these fields are not empty then we can assume that the incident got created in ServiceNow.

 

Step 3: Check the same incident number(INC0010669) in Service Now. If the values of the mapped field are correct in an incident of Service Now then the configuration of integration is done.

Note: If you select “Update” under your preferences in Configurations,then Servicenow Incident number and Servicenow Id do not get generated and the Incident is not created in Servicenow.And it is shown as follows:

 

If you select “Create” under your preferences in Configurations, then Servicenow Incident number and Servicenow Id get generated and the Incident is created in Servicenow.It restricts updation of Incident

Step 4: Enjoy this seamless integration between Jira to ServiceNow

7. Release Note:

Version 1.0.0

  • Jira issue update feature on incident update in Service Now

  • Ability to save field mapping information between JIRA and service now fields

  • Ability to view field mapping information between JIRA and service now fields

  • Ability to delete field mapping information between JIRA and service now fields

  • Ability to add field value mappings

  • Ability to delete the field value mappings

  • Ability to create incident in service now whenever a ticket gets created in JIRA

  • Ability to update incident in service now whenever a ticket gets updated in JIRA

  • Ability to create comment in service now whenever a comment is put in JIRA

  • Ability to filter the records based on applied filters

  • Ability to paginate through the records based on applied filters

  • Ability to log the events to the screen

  • Ability to remove all the configurations for a client

  • Ability to add integration user

  • Ability to restrict the creation/updation of incident based on preference configurations.