1 answer
- 10-1
Andrew
> replica.customFields."On hold reason"?.name
results in 'On hold reason'
The map does not contains such entry, and results in a 'Null'
Consequence is that the value is not set.
What you would need to do isdef holdMapping = [ // Jira hold reason <-> SNOW hold reason "Awaiting Change" : "Awaiting Change" "Awaiting Vendor" : "Awaiting Vendor" ] def holdName = holdMapping[replica.customFields."On hold reason"?.value?.value] incident.hold_reason = holdName
This should return the right mapping.
Given that the values on serviceNow is an integer, you probably need to adapt the mapping- Andrew
Hello,
I wanted to get on hold reason field from Jira to SN.
I did several tests for the below payload from Jira SD:
"11402": {
"id": 11402,
"name": "On hold reason",
"type": "OPTION",
"value": {
"id": "11870",
"sequence": 1,
"value": "Awaiting Change",
"disabled": false,
"childOptions": []
}
},
I prepared mapping in incoming script in SN:
def holdMapping = [
// Jira hold reason <-> SNOW hold reason
"Awaiting Change" : "5"
]
def holdName = holdMapping[replica.customFields."On hold reason"?.value?.value]
incident.hold_reason = holdName
It did not work, so I changed whole above section to single line:
a) incident.hold_reason = replica.customFields."11402"?.value?.value - no result
b) incident.hold_reason = replica.customFields."On hold reason"?.value?.value - no result
Every time state field in SN changed to "On Hold" but hold_reason field was empty.
Please help.
Add your comment...
Hello,
I am having problem configure mapping in incoming script in ServiceNow for integer field (on-hold reason), while Jira is sending on-hold reason from text field.
Payload from Jira is below:
In incoming SN script I have tried this, but did not help:
def holdMapping = [
// Jira hold reason <-> SNOW hold reason
"Awaiting Change" : "Awaiting Change"
"Awaiting Vendor" : "Awaiting Vendor"
]
def holdName = holdMapping[replica.customFields."On hold reason"?.name]
incident.hold_reason = holdName
ServiceNow hold_reason field is integer type and looks as below: