JIRA integration: Passing Work notes as Comments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 02:58 AM
Dear Members,
Requirement: - Sending Work notes as Comment via REST API to JIRA.
Implementation: - I have created the below Business rule which runs on Insert/Update of an Incident and also a REST API.
Issue: - Getting the error JIRA Comments: {"errorMessages":["There was an error parsing JSON. Check that your request body is valid."]} in the System Log. However, the Comment in the JIRA gets created when parameters are passed directly from the Outbound REST API Message.
Release: - Xanadu
Please suggest.
Outbound REST API Message: - https://<confidential>.atlassian.net/rest/api/3/issue/${correlation_id}/comment
Thanks,
Neha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 03:03 AM
seems you are not forming the JSON body properly
when you use current.work_notes.getJournalEntry(1) it gives you the extra information as well i.e. date/time, user and the actual comment.
How did you test it from REST Message? did you give simple text value?
Can you hard-code the work notes in BR and see if it works?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 03:23 AM
@Ankur Bawiskar If I hard-code the Work notes in BR then the Comment is getting created in the JIRA. Also, if I pass the same value from the Outbound REST API then also the Comment is getting created. The issue is only when you pass the dynamic values from ServiceNow. Please find the screenshot: -
Business Rule:-
System Log: -
Comment in JIRA: -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 03:30 AM
the work notes in your logs show the html tags etc. Did you paste the same and test using the Test functionality under that REST Message
I could see in your logs the response body came fine and that log is from BR
So it worked fine
I am not getting what didn't work.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 04:09 AM
I have passed the Hard code values so it is working fine as shown in the logs. But when I dynamically pass the value (i.e. every time the Work Notes entered) the Comment in the JIRA doesn't create and Log shows the below error: -