Hi there,
I'm attempting to finalize the setup of automation that will convert the text within a custom text field into a label and add it to the existing labels on an issue.
When I attempted to accomplish this feat, I've been unsuccessful but have been scratching my head with the syntax error I believe I'm facing. For those finding this in the future, maybe this will be helpful:
{
"fields": {
"labels": [
"{{issue.labels}}",
"{{issue.customfield_1111111.replace(" ","_").replaceAll("["$&+,:;=?@#|'<>.^*()%!-"]", "_")}}"
]
}
}
Hi @Jay Dubinsky ,
Welcome to the community! Hope you like it here and glad you're using labels – in my mind one of the coolest features of Jira.
Setting labels with Automation is not as straight-forward as one might want, but ultimately not too bad. I'll assume that you already got your trigger set up and are just looking for a way to add the label. Here's the what that would look like:
The important thing to note here, is that you'll need to include the current labels with this line:
"{{issue.labels}}",
Of course, instead of using a smart value to grab part of the summary, you'll want to get your custom field.
Hope that helps,
Oliver
Thank you so much Oliver, this was helpful!
I was able to clean up some syntax issues I was running into so this was extremely helpful!
I forgot one small piece to this: the text field in use has spaces in between the name and I need to convert those to underscores to be accepted in a label.
Below is the code I'm actively using without success:
I sincerely appreciate all of the help! I'm just a bit puzzled on this one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jay Dubinsky -- Welcome to the Atlassian Community!
Two things of note:
Please try the replace() function to substitute your spaces for underscores: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#replace-String-target--String-replacement-
And, when using the edit issue action, either select the field (from the dropdown) and enter your smart value expression, or use the advanced edit with JSON. Do not try to use both for the same field, Labels.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.