1
0
-1

I have 2 select fields in ServiceNow that I need to populate a cascading list in Jira Cloud. I can get the parent value populated but I cannot get the child value to populate. 


ServiceNow outgoing sync:

replica.category = entity.category
replica.subcategory = entity.u_subcategory


Jira Cloud incoming sync

issue.customFields."Category/Subcategory".value = nodeHelper.getCascadingSelect(
nodeHelper.getOption(issue, "Category/Subcategory", replica.category),
nodeHelper.getOption(issue, "Category/Subcategory", replica.subcategory)
)


ServiceNow is sending the info because when I use debug.info("replica.subcategory is ${replica.subcategory}") I get the the following:

[replica.subcategory is Decommission] 



This works the other way. I can get the cascading list to populate 2 separate fields in ServiceNow


Jira outgoing sync

replica.customFields."Category/Subcategory" = issue.customFields."Category/Subcategory"


ServiceNow incoming sync

//Category
entity.category= replica.customFields."Category/Subcategory"?.value?.parent?.value
//Subcategory
entity.u_subcategory = replica.customFields."Category/Subcategory"?.value?.child?.value

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      What is the result of


      nodeHelper.getOption(issue, "Category/Subcategory", replica.subcategory)
      1. Karen Jennings

        I get this result: [nodeHelper.getOption is null]

      2. Francis Martens (Exalate)

        Can you check the value of replica.subcategory and look it up in the option list .
        (Make sure there are spaces or other tricks which make it hard for the exalate to find the value)

      3. Karen Jennings

        When I use debug.info("replica.subcategory is ${replica.subcategory}") I get the the following:

        [replica.subcategory is Decommission] 


        The available values on each side match. These were copied from ServiceNow into Jira when we set up this field.  I verified there are no trailing spaces for any of the values on each side. 


        ServiceNow options:


        Jira options:


        When I look at the payload from ServiceNow it shows this: 

        "category": "Network",
         "subcategory": "Decommission",

        When I look at the Jira payload it shows this:
         "Category/Subcategory": {
                "id": 10036,
                "name": "Category/Subcategory",
                "uid": "10036",
                "type": "CASCADING_SELECT",
                "value": {
                  "parent": {
                    "id": "10024",
                    "value": "Network"
                  }
                }
              },

        Is there something else I can check for the options?
      4. Francis Martens (Exalate)

        Oopsie :blush:


        You should use the getCascadingSelect method - more about it here

      5. Karen Jennings

        That worked!


        It looked like this for Jira Incoming:


        def parentcat = nodeHelper.getOption(issue, "Category/Subcategory", replica.category)
        issue.customFields."Category/Subcategory".value = nodeHelper.getCascadingSelect(
        parentcat,
        parentcat.childOptions.find{it.value == replica.subcategory}
        )


        Thank you so much!


      6. Francis Martens (Exalate)

        you're welcome and thanks for providing the outcome.

      CommentAdd your comment...