# How to synchronize different field types: Jira (string) and ServiceNow (integer)

**URL:** <https://community.exalate.com/t/how-to-synchronize-different-field-types-jira-string-and-servicenow-integer/4511>\
**Category:** General Questions\
**Tags:** servicenow-jira, migrated\_question, jira-servicenow-inte\
**Created:** [November 4, 2024, 7:03am UTC](https://community.exalate.com/t/how-to-synchronize-different-field-types-jira-string-and-servicenow-integer/4511 "2024-11-04T07:03:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 7:03am UTC](https://community.exalate.com/t/how-to-synchronize-different-field-types-jira-string-and-servicenow-integer/4511/1 "2024-11-04T07:03:07Z")

</div>

_Originally asked by Andrew on 16 December 2020 [(original question)](https://oldcommunity.exalate.com/questions/20123401)_

* * *

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:

```auto
      "11402": {
        "id": 11402,
        "name": "On hold reason",
        "type": "OPTION",
        "value": {
          "id": 11871,
          "sequence": 2,
          "value": "Awaiting Vendor",
          "disabled": false,
          "childOptions": []
        }

```

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:

 ![](https://europe1.discourse-cdn.com/flex018/uploads/exalate1/original/1X/bf6721b282611ce19bd671e194f7fb393bbe4807.png)

* * *

---

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 7:03am UTC](https://community.exalate.com/t/how-to-synchronize-different-field-types-jira-string-and-servicenow-integer/4511/2 "2024-11-04T07:03:09Z")

</div>

_Answer by Francis Martens (Exalate) on 16 December 2020_

Andrew

\> replica.customFields.“On hold reason”?.name  
results in ‘On hold reason’

 ![](https://europe1.discourse-cdn.com/flex018/uploads/exalate1/original/1X/ee4890afa71e462eaf691dd0c2e58ce6e073b630.png)  
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 is

```auto
def 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

* * *

#### Comments:

> **Andrew commented on 14 January 2021**
>
> > 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.
