Originally asked by SANDEEP ADE on 08 February 2022 (original question)
I have the following code
JIRA SENDING SIDE
replica.customFields."Functional Area – PCM”= issue.customFields.“Functional Area - PCM”
ALM INCOMING SIDE
defect.customFields.“FunctionalArea”.value = replica.customFields.“Functional Area - PCM”?.value.value
Previously the sync rules allowed the below code
defect.customFields.“FunctionalArea”.value = replica.customFields.“Functional Area - PCM”?.value?[0].value
and our sync worked ,but now the above line is throwing error
Comments:
SANDEEP ADE commented on 09 February 2022
Even though i am copying the field name from the remote replica ,still its showing Null value.
Below is the remote replica
“Functional Area – PCM”: {
“id”: 15205,
“name”: “Functional Area - PCM”,
“uid”: “15205”,
“type”: “OPTION”,
“value”: {
“id”: “22009”,
“sequence”: 6,
“value”: “PCM”,
“disabled”: false,
“childOptions”:
}
}
},
Francis Martens (Exalate) commented on 09 February 2022
SANDEEP ADE
What is the error thrown?
SANDEEP ADE commented on 09 February 2022
I am getting “Cannot get property ‘value’ on null object”
But in the remote replica i am seeing the below
“Functional Area – PCM”: {
“id”: 15205,
“name”: “Functional Area - PCM”,
“uid”: “15205”,
“type”: “OPTION”,
“value”: {
“id”: “22009”,
“sequence”: 6,
“value”: “PCM”,
“disabled”: false,
“childOptions”:
}
}
},
I tried the below options but both are throwing error
defect.customFields.“BG_USER_02”.value = replica.customFields.“Functional Area - PCM”.value.value
defect.customFields.“BG_USER_02”.value = replica.customFields.“Functional Area - PCM”.value(0).value
Francis Martens (Exalate) commented on 09 February 2022
Can it be that defect.customFields.“BG_USER_02” is null?
SANDEEP ADE commented on 09 February 2022
i didn’t quite get what you said
BG_USER_02 is a field in ALM ,i am trying to populate the value “PCM” received from Functional Area – PCM from JIRA in BG_USER_02 which is ALM.
i have the code as below,
JIRA SENDING SIDE
replica.customFields."Functional Area – PCM”= issue.customFields.“Functional Area - PCM”
ALM INCOMING SIDE
defect.customFields.“BG_USER_02”.value = replica.customFields.“Functional Area - PCM”.value.value
and to confirm Functional Area - PCM is not Null because in the remote replica i am seeing value as PCM for this field
So not sure whats the issue
Francis Martens (Exalate) commented on 09 February 2022
It can still be that the nullpointerexception is raised by
defect.customFields."BG_USER_02".value
So the question - can you check what defect.customFields.“BG_USER_02” returns when doing
debug.error("defect.customFields.BG_USER_02 = ${defect.customFields."BG_USER_02".properties}")
SANDEEP ADE commented on 09 February 2022
javax.script.ScriptException: com.exalate.api.exception.IssueTrackerException: defect.customFields.BG_USER_02 = [value:null, type:STRING, class:class com.exalate.basic.domain.hubobject.v1.BasicHubCustomField, uid:BG_USER_02, id:null, locked:false, description:null, name:null]
i got this error
SANDEEP ADE commented on 09 February 2022
Also i added below line
def remoteValue = replica.customFields.“Functional Area - PCM”.value.value to see the value on incoming remote field ,it gave error as Cannot get property ‘value’ on null object
but i see the value in remote replica
"Functional Area – PCM": {
"id": 15205,
"name": "Functional Area - PCM",
"uid": "15205",
"type": "OPTION",
"value": {
"id": "22009",
"sequence": 6,
"value": "PCM",
"disabled": false,
"childOptions": []
}
}
SANDEEP ADE commented on 09 February 2022
its resolved now
issue was the “-” symbol ,the field name is Functional Area - PCM
and in script it was types as Functional Area – PCM