1
0
-1

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

  1. SANDEEP ADE

    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": []
            }
          }
        },

  2. SANDEEP ADE

    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 


  3. Francis Martens (Exalate)

    Can it be that defect.customFields."BG_USER_02" is null?


  4. SANDEEP ADE

    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

  5. Francis Martens (Exalate)

    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}")
  6. SANDEEP ADE

    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

  7. SANDEEP ADE

    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": []
            }
          }
  8. SANDEEP ADE

    its resolved now


    issue was the "-" symbol ,the field name is Functional Area - PCM 

    and in script it was types as Functional Area – PCM 


CommentAdd your comment...