Add new tag to zendesk ticket

Originally asked by Daniel Carvajal on 19 August 2021 (original question)


Question by Sydney:
I’m looking to add a new, non-existent tag to a zendesk ticket that has been created through an Exalate sync. The label does not exist in GitHub so there is nothing to sync. I’ve tried a number of different ways to do this but nothing has worked. Here is what I’m currently trying in the incoming zendesk sync:

//add github tag
if (issue.typeName == "incident") {
  issue.labels += nodeHelper.getLabel("github")
}

Answer by Ariel Aguilar on 20 August 2021

Hi Sydney,

If you are trying to create a new a label maybe you can try to do:

GitHub Outgoing script:

replica.typeName        = issue.typeName

Then, Zendesk Incoming script:

if (replica.typeName == "Issue") {
  issue.labels += nodeHelper.getLabel("github")
}

This should add the tag to the Zendesk ticket without problems. Notice I replaced “incident” by “Issue” since that is the typeName showing up on the Remote Replica found in Zendesk. Let me know if this works for you.

Kind regards,

Ariel