1
0
-1

How do I sync Organization in Zendesk to a list field in Jira - and specify a default if the value is not found?


Sync works (with help from : Sync organization from Zendesk to Jira) if the value sent from Zendesk does exist in the Jira single select list field:


Zendesk outgoing sync 

def orgId = issue.organization_id 
if(orgId){
  def orgName = httpClient.get("/api/v2/organizations/"+(long)orgId+".json").organization.name
  replica.customKeys."Organization" = orgName
}

Jira incoming sync 

issue.customFields."OEMs".value = replica.customKeys.Organization 


Tried setting the default to "Others" like this but it did not work:


Jira incoming sync 

issue.customFields."OEMs".value = replica.customKeys.Organization ?: "Others" 

thanks, 

Sandra

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi Sandra, 

      I would suggest you to try the following script in your incoming Jira instance:

      def orgOption = nodeHelper.getOption(issue, "Organization", replica.customKeys.Organization) 
      
      if(orgOption == null){
          issue.customFields."Organization".value = nodeHelper.getOption(issue, "Organization", "Others")
      }
      else {
          issue.customFields."Organization".value = orgOption
      }


      the outgoing Zendesk doesn't need to be modified.

      Best,
      Ezequiel

        CommentAdd your comment...