xl8bot
November 4, 2024, 8:00am
1
Originally asked by Olimpia Estela Caceres-Brown on 28 November 2022 (original question)
We have written the logic from ServiceNow to Jira sync where we are trying to set
i. Jira state to " Resolved"
ii. Copy Resolution Code and Notes to Jira
Here is our Jira Service Management Incoming sync Logic
Can anyone help us to know what we are missing here?
def localStatus = null
if (replica.close_code == "Not Solved (Declined)") {
localStatus = "WAITING FOR SUPPORT"
syncHelper.unExalateAfterProcessing()
} else if (replica.close_code == "Closed/Resolved by Caller") {
localStatus = "Canceled"
} else {
def statusMap = [
"Resolved": "Resolved"
]
def remoteStatusName = replica.status ?.name
localStatus = statusMap[remoteStatusName]
}
if (localStatus) {
issue.setStatus(localStatus)
}
issue."Close Code" = replica.close_code
issue."Close Notes" = replica.close_notes
if (replica.close_notes && replica.close_notes != previous.close_notes) {
def comment = commentHelper.addComment(replica.close_notes, [ ]).find()
comment.internal = false
comment.executor = nodeHelper.getUser("Jira Service Desk key") //Jira Service Desk Agent
issue.comments += comment
}
Any advise will be greatly appreciated!
Thanks,
Olimpia Estela and Vaihnavi Shinde
xl8bot
November 4, 2024, 8:00am
2
Answer by Vaishnavi on 05 December 2022
Hi Sonal,
Thanks for your quick response on our Question. We tried changing the Jira incoming code as you mentioned but still it doesn’t really worked for us.
Here is the ServiceNow Outgoing logic
if (entity.tableName == "incident") {
if ((entity.state == "Resolved")) {
replica.close_code = entity.close_code
replica.close_notes = entity.close_notes
}
replica.status = entity.state
replica.IST_Incident_Number = entity.number
replica.attachments = entity.attachments
replica.comments = entity.comments
replica.IST_Status = entity.state
replica.urgency = entity.urgencyValue
replica.impact = entity.impactValue
}
Can you please help us knowing where we are missing.
Comments:
Sonal Otwani commented on 13 December 2022
Hi Vaishnavi ,
So in this case you need to use:
def remoteStatusName = replica.status
Let me know if this will work or not.
Thanks and Regards,
Sonal
xl8bot
November 4, 2024, 8:00am
3
Answer by Sonal Otwani on 29 November 2022
Hi Olimpia Estela Caceres-Brown ,
Can you please check what is the script in your outgoing sync of ServiceNow regarding status field?
Mostly it will contain following script (let me know if it is different):
replica.state = entity.state
In this case, the incoming sync script will be:
def remoteStatusName = replica.state
instead of:
def remoteStatusName = replica.status ?.name
Let me know in case it will not work after this line change.
Thanks,
Sonal