Hello,
I'm trying to build an automation to update the label with the assignee display name-HI when the assignee is changed. Since labels do not accept spaces, I need to use the advanced fields (https://support.atlassian.com/jira-software-cloud/docs/advanced-field-editing-json/ and https://confluence.atlassian.com/jirakb/automation-for-jira-fails-to-copy-components-list-to-label-with-error-message-the-label-contains-spaces-which-is-invalid-1072473388.html) .
So, if I assignee an issue to a user named First Last, I'd like the label to be FirstLast-Hi
I have attempted dozens of configurations , but always get an error. I am hoping someone can assist in getting this to work:
{
"update": {
"labels": [{
"add": "{{assignee.displayName.remove(" ").concat("-RH")}}"
}]
}
}
Here's the error:
Error editing issues: (Field labels cannot appear in both 'fields' and 'update')
Thank you in advance!
Allison
Hi @Allison
I noted that you have nested double-quoting in your update, due to formula usage. Have you tried to work around that by switching to single-quotes inside?
"add": "{{assignee.displayName.remove(' ').concat('-RH')}}"
Or, you could save the right-side value to a created variable and then use that one.
Best regards,
Bill
Thank you for your reply, Bill!
I attempted to replace the double quotes with single quotes and still had the same result. (Field labels cannot appear in both 'fields' and 'update')
Taking the next step of your advice, I tried to remove the second value/calculation and had the same result.
It seems the syntax is correct, so I'm stumped! Thanks so much for the help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Fascinating...It appears that concat() will not work with single quotation marks.
So one workaround is to put this in a created variable and then set the labels to it:
{{issue.assignee.displayName.remove(" ").concat("-RH")}}
To set the labels to the smart value from the created variable (e.g. let's say we named it varAssigneeLabel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Bill! Is this feature available in Jira Server? From what I see you posted on another article, it seems I may be out of luck on the workaround, too. https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Create-variable-New-component/ba-p/1448118
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just figured it out!
The syntax of the first example was correct. The issue was that I had the labels set to be cleared (look under the cog icon)
Once I removed the "this field will be cleared action" everything worked. I think the two settings were conflicting each other throwing it into a loop.
Thanks again for your help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry about that! I noted the tagging which indicated you were using Cloud.
I just tried this and it worked for cloud, so you'll need to test for server: just do it directly without a variable or JSON edit...
Edit issue for the labels field, and paste that smart value expression in directly. When it shows beneath the field, and save. Then try the rule:
{{issue.assignee.displayName.remove(" ").concat("-RH")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, two edits of labels. If you noted above, you may also be able to do this without the advanced edit.
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.