Originally asked by Aleksi-Mikael Kivelä on 24 February 2022 (original question)
Hi,
We are trying to sync incidents between Jira & ServiceNOW.
However, we are running into an issue where the Service Offering will only get synced during the first sync from Jira to ServiceNOW and not afterwards.
In the documentation, the Service Offering is not listed as an available field but would it still be possible to sync this field somehow (and why would it sync during the first phase but not afterwards?) because it is vital for our solution.
Answer by Francis Martens (Exalate) on 24 February 2022
Can you provide more details
What is âservice offeringâ
What is the outgoing sync script on the servicenow side
What is the incoming sync script on the Jira side
Comments:
Aleksi-Mikael Kivelä commented on 24 February 2022
Service Offering is a reference field in ServiceNOW (similar to Business Service).
Outgoing script:
if(entity.tableName == "incident") {
replica.key = entity.key
replica.reporter = entity.caller_id.name
replica.summary = entity.short_description
replica.description = entity.description
replica.attachments = entity.attachments
replica.comments = entity.comments
replica.state = entity.state
replica.priority = entity.priority
replica.substate = entity.u_on_hold_reason
replica.issue_key = entity.correlation_id
replica.close_code = entity.close_code
replica.close_notes = entity.close_notes
replica.department = entity.company
if(entity.business_service){
replica.business_service = entity.business_service.display_value
}
if(entity.service_offering){
replica.service_offering = entity.service_offering.display_value
}
/*
Use a field"s internal name to send its value
Example: Resolution Notes -> resolution_notes
This works for all other entity types as well
replica.resolution_notes = entity.resolution_notes
*/
}
Incoming script:
if(firstSync){
//Decide on the first sync, which entity you want to create based on the remote issue type
entity.tableName = "incident"
entity.state = 1
entity.caller_id = "No contact"
entity.short_description = replica.summary
entity.description = replica.description
}
if(entity.tableName == "incident") {
entity.attachments += replica.addedAttachments
entity.comments += replica.addedComments
if(replica.customFields."division-exalate") {
entity.company = replica.customFields."division-exalate".value
}
if(replica.business_service) {
entity.business_service = replica.business_service.value
}
if(replica.service_offering) {
entity.service_offering = replica.service_offering.value
}
switch(replica.priority) {
case "P1":
entity.impact = 1
entity.urgency = 1
break
case "P2":
entity.impact = 2
entity.urgency = 1
break
case "P3":
entity.impact = 1
entity.urgency = 3
break
case "P4":
entity.impact = 3
entity.urgency = 1
}
The problem is, that the Service Offering -field will get populated correctly when the incident is created from Jira but the field gets completely ignored by Exalate in subsequent updates.
Aleksi-Mikael Kivelä commented on 24 February 2022
Addendum:
We donât have access to the Jira side script, since we arenât actually developing that end of the integration.