Hi community, I´m setting an automation to add a label in a label manager field in a parent issue from the same field in a child issue. I´m not looking for replacing the value/s. I looking to add them to the existing ones.
This field doesn´t appear on the Choose field to set dropdown, so I went with More Options. How I have it currently set works only if there is one or less label on each issue.
If there are already two Labels on the parent issue, or there are two labels on the triggerIssue this automation fails. Here are the Audit logs.
The labels are indeed defined as it is the same project, but instead of reading it as two labels it is reading it as one longer label.
Any idea? I think this can also be approach with scriptrunner but I wouldn´t know how to go about it.
Hi @Labadie_ Agustin - Contractor , I came across your older question but was interested to see if I could get it to work. I did - with some caveats.
First, I'm using Cloud and you're using Data Center. So, it's possible my solution won't work for you, although the automation functionality was built by the same folks, so I have high hopes it will. Second, it's possible that this didn't work in Data Center back in 2024 but does now. Regardless, here are two ways I got this to work, in case it helps you or someone else doing something similar.
To simulate your use case, I linked a Jira issue (the source issue) to another Jira issue (the destination issue) and manually triggered the automation from the source issue. The source issue contained three different labels. The destination issue contained no labels. I used the standard Jira "labels" field.
Method 1: Selecting the "Labels" field (Jira Cloud)
In this first example, Jira Cloud allowed me to select the standard "Labels" field and use built-in settings to copy the value of the field to another Jira issue. Easy peasy.
Method 2: Using JSON only (Jira Cloud)
For the second example, I pretended that the "Labels" field was not selectable (like you mentioned) and did it with a small snippet of JSON code instead.
Code snippet I used:
{
"fields": {
"labels": {{triggerIssue.labels.asJsonStringArray}}
}
}
Note: {{triggerIssue.labels}} will not work, as this field may contain multiple selections stored as comma-separated values. Splitting them into an array did the trick! I assume this might be related to the problem you encountered.
I don't know if any of this will help or if you even still need help, but regardless, I sure had fun trying it!
So thanks,
Rachel Wright
Author, Jira Strategy Admin Workbook
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.