- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2020 06:46 PM
I am trying to integrate ServiceNow with Jira and worked out how to sync new ticket create in Jira when new incident created in ServiceNow through Scripted REST API. It works fine, but i still could not figure out how update comments in both direction.
I tried webhook, connection works fine between ServiceNow and Jira. When Jira tickets updated new response sent to SNOW and I can see it under logs in JSON format. but I don't know how to get values from this response body and fetch into relevant ServiceNow tickets under comment field.
I really appreciated if someone can help me here:
Json response body:
{"timestamp":1589671258662,"webhookEvent":"comment_created","comment":{"self":"https://Jirasnowintegration.atlassian.net/rest/api/2/issue/10060/comment/10000","id":"10000","author":{"self":"https://Jirasnowintegration.atlassian.net/rest/api/2/user?accountId=5ea23ec8c0b45b0c17a88675","accountId":"5ea23ec8c0b45b0c17a88675","avatarUrls":{"48x48":"https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/5ea23ec8c0b45b0c17a88675/e4ab785d-60d3-4f7e-8627-650abcd42289/128?size=48&s=48","24x24":"https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/5ea23ec8c0b45b0c17a88675/e4ab785d-60d3-4f7e-8627-650abcd42289/128?size=24&s=24","16x16":"https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/5ea23ec8c0b45b0c17a88675/e4ab785d-60d3-4f7e-8627-650abcd42289/128?size=16&s=16","32x32":"https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/5ea23ec8c0b45b0c17a88675/e4ab785d-60d3-4f7e-8627-650abcd42289/128?size=32&s=32"},"displayName":"Han Ata","active":true,"timeZone":"Australia/Sydney","accountType":"atlassian"},"body":"I have broken mouse","updateAuthor":{"self":"https://Jirasnowintegration.atlassian.net/rest/api/2/user?accountId=5ea23ec8c0b45b0c17a88675","accountId":"5ea23ec8c0b45b0c17a88675","avatarUrls":{"48x48":"https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/5ea23ec8c0b45b0c17a88675/e4ab785d-60d3-4f7e-8627-650abcd42289/128?size=48&s=48","24x24":"https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/5ea23ec8c0b45b0c17a88675/e4ab785d-60d3-4f7e-8627-650abcd42289/128?size=24&s=24","16x16":"https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/5ea23ec8c0b45b0c17a88675/e4ab785d-60d3-4f7e-8627-650abcd42289/128?size=16&s=16","32x32":"https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/5ea23ec8c0b45b0c17a88675/e4ab785d-60d3-4f7e-8627-650abcd42289/128?size=32&s=32"},"displayName":"Han Ata","active":true,"timeZone":"Australia/Sydney","accountType":"atlassian"},"created":"2020-05-17T09:20:58.662+1000","updated":"2020-05-17T09:20:58.662+1000","jsdPublic":true},"issue":{"id":"10060","self":"https://Jirasnowintegration.atlassian.net/rest/api/2/10060","key":"CAD-58","fields":{"summary":"Test test","issuetype":{"self":"https://Jirasnowintegration.atlassian.net/rest/api/2/issuetype/10001","id":"10001","description":"Functionality or a feature expressed as a user goal.","iconUrl":"https://Jirasnowintegration.atlassian.net/secure/viewavatar?size=medium&avatarId=10315&avatarType=issuetype","name":"Story","subtask":false,"avatarId":10315},"project":{"self":"https://Jirasnowintegration.atlassian.net/rest/api/2/project/10000","id":"10000","key":"CAD","name":"CAD","projectTypeKey":"software","simplified":false,"avatarUrls":{"48x48":"https://Jirasnowintegration.atlassian.net/secure/projectavatar?pid=10000&avatarId=10409","24x24":"https://Jirasnowintegration.atlassian.net/secure/projectavatar?size=small&s=small&pid=10000&avatarId=10409","16x16":"https://Jirasnowintegration.atlassian.net/secure/projectavatar?size=xsmall&s=xsmall&pid=10000&avatarId=10409","32x32":"https://Jirasnowintegration.atlassian.net/secure/projectavatar?size=medium&s=medium&pid=10000&avatarId=10409"}},"assignee":null,"priority":{"self":"https://Jirasnowintegration.atlassian.net/rest/api/2/priority/3","iconUrl":"https://Jirasnowintegration.atlassian.net/images/icons/priorities/medium.svg","name":"Medium","id":"3"},"status":{"self":"https://Jirasnowintegration.atlassian.net/rest/api/2/status/10000","description":"","iconUrl":"https://Jirasnowintegration.atlassian.net/","name":"Backlog","id":"10000","statusCategory":{"self":"https://Jirasnowintegration.atlassian.net/rest/api/2/statuscategory/2","id":2,"key":"new","colorName":"blue-gray","name":"To Do"}}}}}
Solved! Go to Solution.
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2020 07:37 PM
try below
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
var body = JSON.stringify(request.body.data);
var parser = new JSONParser();
var parameterArr = parser.parse(body);
var gr = new GlideRecord("incident");
gr.addQuery("u_jira_issueid", parameterArr.issue.key);
gr.query();
if (gr.next()) {
gr.work_notes = 'Commented by: ' + parameterArr.comment.author.displayName + '\nComment: '+ parameterArr.comment.body;
gr.update();
//gs.log(parameterArr.comment.body);
}
})(request, response);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2021 07:07 AM
Hi,
I am integrating servicenow with jira to insert additional comments in jira instance comment. I used your solution to map additional comments field with jira comment.
I am not able to insert the comments in jira instance(jira issue) but I am able to see the comments in system logs. Also if somebody can let me know about the content in query parameters in the rest message that would be helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2021 07:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2022 05:29 AM
mike, thanks for the provided solution. i intend to try it for some of my next projects, to test it. so far, whenever we did work on this particular integration, we're using an external help - a connector called zigiops. you can check it out just for reference. it needs no additional coding and offers templates (which i think is great, given the fact that usually, we do transfer various data.