I have a connection from ServiceNow to Jira Cloud. However, when I view the comments in Jira Cloud, the formatting appears incorrect.
Hi
The issue here is, Jira supports wiki format, whereas ServiceNow does not.
You may experience that the comment text may contain \n
and \t
, which are being transferred from ServiceNow. These characters need to be converted into a format that Jira supports which is Wiki format.
To resolve this, configuration changes will likely be needed in the Jira incoming sync script.
we need to change following incoming jira cloud script
issue.comments = commentHelper.mergeComments(issue, replica)
with
issue.comments = commentHelper.mergeComments(issue, replica) { comment ā
// Step 1: Replace ā\nā with newline
comment.body = comment.body.replaceAll(ā\\nā, ā\nā)// Step 2: Convert Unicode escape sequences to characters def convertUnicode = { match -> def codePoint = Integer.parseInt(match[1], 16) return new String(Character.toChars(codePoint)) } comment.body = comment.body.replaceAll(/\\u([0-9A-Fa-f]{4})/, convertUnicode) // Step 3: Replace bullets and other formatting for Jira wiki comment.body = comment.body.replaceAll("ā |ā¢", "* ") // Replace Unicode bullets with Jira bullets (* ) comment.body = comment.body.replaceAll("\\\\t", " ") // Replace tabs with a space for better formatting
}
Thanks