- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 06-27-2021 10:31 AM
Prerequisites-
- ServiceNow Instance
- JIRA Instance
Steps:
- Get ServiceNow Instance
- Get JIRA instance
- Create a Project in JIRA
- Create an Authentication token in JIRA
i. Go to JIRA instance-> Go to account settings https://id.atlassian.com/manage-profile/profile-and-visibility
ii. Click on Security.
iii. Go to Create and Manage API tokens
iv. Click on Create API Token
Note: Please note down this API Key somewhere as it is visible only at the time of creation.
These are the necessary setting to be done in JIRA in order to begin with Integration.
5. Now in the ServiceNow instance, we need to create a Rest Message under System Web Services-> Outbound -> REST Message.
6. Click on New. This will open a new form to enter the details of Rest Message.
Name: provide the name for the Rest Message.
Description: provide the details as in what all methods will be created from this Rest Message.
Endpoint: endpoint comprises of the instance name with the Rest API version the 3rd party application is providing.
Authentication Type: provide the authentication type used by the API. (Basic/OAuth 2.0)
7. Select the Authentication Type as Basic. A field “Basic auth profile” will be visible, specify the profile or create new.
8. To create a new Basic auth profile.
i. Click on the search option from the field the following window will open -> Click on New.
ii. Provide the following details
Name: Name given to the profile
Username: The email address used to create the JIRA instance
Password: This will be the API Key that we created in the JIRA -> Security. (Refer from step: 4. iv.)
9. Click on Default Get.,
- Provide the endpoint and HTTP Request in headers
- Accept: application/json, Content-Type: application/json
- Click on Test
Integration Usecase
If any new Incident for enhancement request is raised in ServiceNow, create a JIRA User Story and store the JIRA ID on the Incident for that particular enhancement.
1.Create the category and subcategory in ServiceNow
Category: Request
Subcategory: Enhancement
2. Go to System Web Services -> Outbound -> Rest Message.
3. Open the Rest Message that we created. In this Rest Message, we will add a new HTTP method in order to achieve the integration.
4. In this scenario, we need to create a JIRA Story with ServiceNow’s Incident ID, Description, and Short Description.
5. Provide the following details in the new HTTP Method:
a. Name: Create JIRA story
b. HTTP Method: POST
c. Endpoint: https://yourinstancenamehere.atlassian.net/rest/api/3/issue/
d. Authentication type: Inherit from Parent
6. In HTTP Request add the following two headers:
a. Accept: application/json
b. Content-Type: application/json
7. In the Content field, enter the payload that we need to send while creating the JIRA Story
Following is the request body I have used:
{
"fields": {
"project":
{
"key": "SER"
},
"summary": "${shortDescription}",
"issuetype": {
"name": "Story"
},
"customfield_10037": "${incidentNumber}",
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "${description}",
"type": "text"
}
]
}
]
}
}
}
Note: "${shortDescription}”, "${incidentNumber}”, "${description}” are the variables created to pass the data dynamically.
8. Create following new Variable Substitutions
a. Name: description Escape type: No escaping Value: Blank
b. Name: incidentNumber Escape type: No escaping Value: Blank
c. Name: shortDescription Escape type: No escaping Value: Blank
9. You can test, this method by providing some test data in the variables and Click on “Test” from the Related Links.
10. We now need to create a Business rule on Incident Table that will trigger the call to this Rest Message.
11. Details of the Business Rule:
Name: Create Jira Story
Table: Incident
When to Run:
When: after Insert, Update
Filter Conditions:
Category is Request
Subcategory is Enhancement
Advanced:
Script:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
try {
var createJiraStory = new sn_ws.RESTMessageV2('SNOW JIRA Integration', 'Create JIRA Story');
createJiraStory.setStringParameterNoEscape('description', current.description);
createJiraStory.setStringParameterNoEscape('shortDescription', current.short_description);
createJiraStory.setStringParameterNoEscape('incidentNumber', current.number);
var response = createJiraStory.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
var getJiraUserStoryID = JSON.parse(responseBody);
var jiraUserStoryID = getJiraUserStoryID.key;
current.setValue('u_jira_id', jiraUserStoryID);
current.update();
} catch (ex) {
var message = ex.message;
}
})(current, previous);
Note: The code to mention in this business rule can also be obtained from the Rest message
Go to the desired Method you have created. For example, Create Jira Story, in the Related Links you will find the link “Preview Script Usage”, this link gives the sample code you can use in the BR.
12. A field called, “JIRA ID” is created on ServiceNow Incident form, which will be updated after the Story is created in JIRA. The code in the business rules updates the JIRA ID from the response received.
- 8,504 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi ,
You said bidirectional (Servicenow to Jira)so you will also have data come in from the Jira end let's say comment, work node that is coming from Jira. How is update that on the incident?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Bidirectional is pretty complex since Jira and SNOW work on a totally different logic. That's why we have many customers whose first integration is ServiceNow-Jira because they need bidirectional real-time integration, but don't spend time to develop needed logic or amend their processes. Integrating SNOW to Jira shouldn't take longer than 15 mins as a self-service.
Take a look at how to do it here (Youtube)
(and start your free trial here)
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
For some reason, my comment was duplicated.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Kindly share Jira to ServiceNow steps?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content