How to set default value for hold reason field in SN independently from Jira's payload

Originally asked by Andrew on 20 January 2021 (original question)


Hello,

I have on-hold request from Jira SD to SN. Remote payload for hold reason field looks as below.

"11402": {  
"id": 11402,  
"name": "On hold reason",  
"type": "OPTION",  
"value": {  
"id": "11870",  
"sequence": 1,  
"value": "Awaiting Change",  
"disabled": false,  
"childOptions": []  
}

For test purpose, I’m able to save value “Awaiting Change” in SN INC description field:

incident.description = replica.customFields."11402"?.value?.value

but I cannot save it in incident.hold_reason field.

We made decision to have incident.hold_reason=“Hold from Jira” always if on hold state comes from Jira.

I have tried below option:

if (remoteStatusName == "On Hold"){  
incident.hold_reason = nodeHelper.getOption("Hold from Jira")}

but got error. It seems that getOption is not available in incoming script in SN.

Additionally hold_reason field is integer type, below are values definition for hold reason in SN.

In Jira hold reason is a text field

How to solve the issue ?