Servicenow Incoming
if(firstSync){ //Decide on the first sync, which entity you want to create based on the remote issue type entity.tableName = "incident" } if(entity.tableName == "incident") { entity.short_description = replica.summary entity.description = replica.description entity.attachments += replica.addedAttachments entity.comments += replica.addedComments /* Jira Custom Field to ServiceNow Field Apply the value from a Jira custom field to the Resolution Notes This works for all other entity types as well entity.resolution_notes = replica.customFields."Jira CF Name".value */ /* Status Synchronization Sync status according to the mapping [remote incident status: local incident status] If statuses are the same on both sides don"t include them in the mapping def statusMapping = ["Open":"New", "To Do":"Open"] def remoteStatusName = replica.status.name entity.state = statusMapping[remoteStatusName] ?: remoteStatusName */ }
Servicenow Outgoing
if(entity.tableName == "incident") { replica.key = entity.key replica.summary = entity.short_description replica.description = entity.description replica.attachments = entity.attachments replica.comments = entity.comments replica.state = entity.state } if(entity.tableName == "sc_task") { replica.summary = entity.number replica.request_item_entity = "yes" replica.key = entity.key replica.request = entity."request" replica."Assigned Group" = entity.assignment_group replica.requested_for = nodeHelper.getTableByLink(entity.requested_for?.link)?.email replica.opened_at = entity."openened_at" replica.opened_by = nodeHelper.getTableByLink(entity.opened_by?.link)?.email replica.state = entity.state replica.stage = entity.stage replica.comments = entity.comments replica.description = entity.u_description replica."AssignedTo" = nodeHelper.getTableByLink(entity.assigned_to?.link)?.email }