Sync literal string from DevOps to JIRA label and custom field

Originally asked by Mark Anderson on 18 February 2022 (original question)


Hi All

We have one was sync of Tasks from ADO to JIRA cloud

I need to set a Jira label to a constant literal string “ERP”

and the JIRA custom field “Portfolio” to the same value.

This string does not exist in the ADO, it will be hard-coded in the sync config.

My outgoing sync in ADO has these:

replica.labels = nodeHelper.getLabel(“ERP”)

replica.customFields.“Portfolio” = “ERP”

Also tried replica.labels = “ERP”

can anyone point me in the right direction


Comments:

Mark Anderson commented on 18 February 2022

I got it working, but not sure what the custom field assignment does

issue.labels += nodeHelper.getLabel(“ERP”) – this worked

issue.customFields.“Portfolio”.value = replica.customFields.“xyz”?.value ?: “ERP” -– i believe this says if the incoming custom field contains "xyz’ use it, if not use “ERP”

There is no incoming custom field, I just want equivalent of

issue.customFields.“Portfolio”.value = “ERP”

Answer by Francis Martens (Exalate) on 20 February 2022

> issue.customFields.“Portfolio”.value = replica.customFields.“xyz”?.value ?: “ERP” -– i believe this says if the incoming custom field contains "xyz’ use it, if not use “ERP”

That is correct.

> issue.customFields.“Portfolio”.value = “ERP”

I assume it is not working?
If not - can you check on the type of ‘Portfolio’


Comments:

Mark Anderson commented on 21 February 2022

Thanks for reply. Porfolio is a single value select field in JIRA

Francis Martens (Exalate) commented on 21 February 2022

Is ERP in the list (like without spaces) …