Labels not setting on Jira Issue

Originally asked by Kaleigh Garcia on 03 April 2024 (original question)


Hello! I’ve been asked to set the Label on our Jira Issues based on our Category__Text_c field. My script reads below, however, the Label is still coming over blank. I can’t find what I’m missing? This script is in my Jira incoming script.

if (replica.Category_Text__c?.contains("Credible")) {
    issue.labels = issue.labels ?: new HashSet<>()
    issue.labels += nodeHelper.getLabel("Proserv")
    } else if (replica.Category_Text__c?.contains("CareLogic")) {
    issue.labels = issue.labels ?: new HashSet<>()
    issue.labels += nodeHelper.getLabel("CareLogic")
    }

Answer by Javier Pozuelo on 06 April 2024

Hi Kaleigh,

There are several ways to troubleshoot this, firstly I would recommend seeing if Category_Text__c is being sent over in the replica to Jira. To see this, go to Entity sync panel in your Exalate console in Jira, place the issue urn and select “Remote replica”. If you cannot find Category_Text__c the issue resides in the outgoing sync of Salesforce. If it is in the replica, you can try debugging Category_Text__c in the Incoming sync of Jira. The label could be coming in blank because the if statement conditions are not being met, so try doing the following:

debug.error("Category Text: " + Category_Text__c)

The debug.error method will block the synchronization, so after you receive the error message, you can remove the method from your sync rules.