How to check if a label is present in Zendesk?

Originally asked by Mikael Bohlin on 23 September 2020 (original question)


I want to check if a label is not present in Zendesk. If it exist in the ticket a sync shoould not be done.

How to do it ?


Answer by Juan Grases on 23 September 2020

You can retrieve the label from the issue.labels which return a List of labels. You can operate on the list using groovy collection methods:

if(issue.labels.collect{it.label}.contains("No sync")){
  return;
}

Comments:

Francis Martens (Exalate) commented on 23 September 2020

Mikael Bohlin

Add this to the outgoing sync on the top of the script.
Whenever the replica is empty, no sync will be done