How to Sync Label Custom Fields in Jira Cloud

    This article shows how to synchronize a label custom field.

    Let's assume you want to synchronize a label custom field named label - cust1.

    Source Side

    Outgoing sync

    replica.customFields."label - cust1" = issue.customFields."label - cust1"

    Destination Side

    Incoming sync 

    • Set the received label to the local label custom field and if it doesn't find one, it sets an empty array so you don't get a null pointer exception

     Note: This method overrides all the existing labels in the custom field.

    issue.customFields."label - cust1".value = replica.customFields."label - cust1"?.value ?: []
    • Add the received label into the local label custom field

    issue.customFields."Labels".value += replica.customFields."label - cust1"?.value

    How to set a Default Value in a Label Custom Field

    To set a default value in a label custom field use the nodeHelper.getLabel method.

    issue.customFields."Epic/Theme".value = replica.customFields."Tags"?.value ?: [