ServiceNow to Zendesk HTML comments lose formatting

Originally asked by Champ Yarbrough on 16 January 2021 (original question)


How do you make the comment readable?

For example:

Abdel Shaikh

Wednesday 07:39

Product: TC Beacon Environment: MIT Test Process: MS5-C-18 - Terminal - Yard Manager - User Access Roles Short Description: Add a search to the combo box lists for selecting users User base: IT Administrators User: Ahmad Meneses Steps to reproducce: 1. Log in to TCB 2. Go to Administration 3. Go to User Access - > Roles 4. Right Click on a Role 5. Select EDIT 6. Click on the Asociated user list 7. You can’t search by typing the name of the users Actual Behavior: When adding roles to users most of the time you will be doing it for more than whan user, in this initial stage will be a considerable amout of users, and the action of assigning users to roles is cumbersome in this scenario becasue you have to go to the intire list to click one by one the users you need to select Expected Behavior: One example of the expected behavior is unde user administration on MSX, the Mainsail Role Combo Box as an embedde searchbox where you can type and press tab to select. Note: Please be aware that expected behavior is expected in all the application where a combo box with mulitple selection is used.


Comments:

Ariel Aguilar commented on 09 July 2021

Hi Champ,

We have documentation when you want to remove the HTML tags on Zendesk, this should be helpful:

https://docs.idalko.com/exalate/x/ggXHAw

Kind regards,

Ariel

Ariel Aguilar commented on 13 July 2021

Hi Champ,

You can try to use the following:

def includeComments  = replica.addedComments.collect{ comment ->
  comment.executor = nodeHelper.getUserByEmail(comment.author?.email?.toLowerCase() ?: comment.author?.username?.toLowerCase())
  comment.body = comment.body.replaceAll("\\[code\\]", "").replaceAll("\\[/code\\]", "")

  if(comment.executor == null){
     comment.body = "Comment from servicenow by "+comment.author?.username + "\n:" + comment.body
  }
  comment
}
issue.comments     += nodeHelper.toMarkDownComments(includeComments)

Let me know if this works for you.

Kind regards,

Ariel

Ariel Aguilar commented on 13 July 2021

Hi Champ

Or even this:

def includeComments = commentHelper.mergeComments(issue, replica,                     
                    {
                       comment ->
  comment.executor = nodeHelper.getUserByEmail(comment.author?.email?.toLowerCase() ?: comment.author?.username?.toLowerCase())
  comment.body = comment.body.replaceAll("\\[code\\]", "").replaceAll("\\[/code\\]", "")

  if(comment.executor == null){
     comment.body = "Comment from servicenow by "+comment.author?.username + "\n:" + comment.body
  }
  comment
}
issue.comments     += nodeHelper.toMarkDownComments(includeComments)

Kind regards,

Ariel