How to sync Jira comment into ServiceNow work_notes field

Originally asked by HA on 23 April 2021 (original question)


I only want to sync Jira comment into ServiceNow work_notes field.

ServiceNow Incoming rule added:

entity.work_notes += replica.addedComments

but I am getting the below error:


Answer by Francis Martens (Exalate) on 23 April 2021

Hi HA

Please DO NOTuse following construct

entity.work_notes += replica.addedComments

The way ServiceNow works is that updating entity.work_notes will result in a single new work_note containing the provided content. Because the original entity.work_notes (which is provided to the incoming sync) contains all the work notes of the entity, the statement above will effectively duplicate the work_notes.

You can imagine the consequence if you sync this a couple of times.

The proper way to add work notes is by setting the flag ‘internal’ to true

entity.comments += replica.addedComments.collect { 
					it.internal = true
					it
}


Give it a try


Comments:

HA commented on 29 April 2021

Thanks Francis. This worked perfectly.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.