Send comments and worknotes from servicenow to jira
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2022 02:25 AM
I have integrated servicenow and jira. I want to send the comments and work notes from servicenow to jira.
The Business rule which I have written is
(function executeRule(current, previous /*null when async*/) {
try {
var r = new sn_ws.RESTMessageV2('Neste Siili JIRA', 'PUT');
r.setEndpoint('https://neste-jira.atlassian.net/rest/api/3/issue/'+current.correlation_id);
r.setStringParameter("description",current.description);
r.setStringParameter("summary",current.number+' '+current.short_description);
if(current.priority == "1")
{
r.setStringParameter("priority","Critical");
}
if(current.priority == "2")
{
r.setStringParameter("priority","Major");
}
if(current.priority == "3" || current.priority == "4")
{
r.setStringParameter("priority","Minor");
}
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
gs.log("put body jira"+responseBody);
gs.log("put status "+httpStatus);
}
catch(ex) {
var message = ex.message;
}
})(current, previous);
What else I need to add in my business rule for sending comments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2022 09:58 AM
Hi,
To retrieve comments / worknotes (i.e. from the incident record) I propose to use the getJournalEntry()
The example in the above link refers to the work notes,
this line will get comments:
var comments= current.comments.getJournalEntry(-1);
Best Regards,
Marcin
If my answer helped you in any way, please mark this answer as helpful and correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2022 12:06 AM
Hello,
I am sending the payload as follows -
I am getting the error in response as in above screenshot.
How to resolve this issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2022 12:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2022 06:15 AM
Hello,
Please could you give us more details, to which system do you send it?
Which endpoint is used?
Best Regards.
Marcin