Jira Cloud Public to ServiceNow Internal Comments

Originally asked by Mike Fowler on 31 October 2023 (original question)


I have tried looking around, but cant seems to find a suitable answer.

We have Jira Cloud sending public comments to a ServiceNow instance. These comments need to be stored as internal comments on ServiceNow.

Jira Outgoing:

replica.comments       = issue.comments.findAll{!it.internal}

ServiceNow Incoming:

entity.comments            += replica.addedComments

From reading through various bits of Exalate documentation, I have tried the following on ServiceNow incoming:

entity.comments = commentHelper.mergeComments(entity, replica, {it.internal = true})

This fails to work.

Anyone got any ideas?

Cheers,


Answer by Mike Fowler on 17 November 2023

Thank you Mathieu,

I have done some further testing and thanks to the help of Marwan Al Jeburi found that because we are using a table other than the “incident” table, then the above won’t work.

In the end, the following was implemented on the ServiceNow Incoming configuration to get it to work with the custom table:

   entity.comments = ({ 
    cmt ->        
    def result = []        
    result.addAll(cmt)        
    result     })(entity.comments)
    entity.comments = commentHelper.mergeComments(entity, replica, {it.internal = true})

Answer by Mathieu Lepoutre on 31 October 2023

Hello I just verified this on my instance.

This makes all incoming comments internal worknotes in servicenow.

if(firstSync){
    entity.tableName = "incident"
}
if(entity.tableName == "incident") { 
    entity.short_description = replica.summary
    entity.description = replica.description
    entity.attachments += replica.addedAttachments
    entity.comments = commentHelper.mergeComments(entity, replica, {it.internal = true})
}

Thank you.

Kind regards,
Mathieu Lepoutre