Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to copy multi-value field in using Advance Options in Automation Rule?

In an automation rule, created a sub-task and copying a multi-value field like labels/components/fix version etc. from Parent to the child sub-task

I tried both below to set labels from the Parent issue,

"labels": "{{issue.labels}}"

"labels": [ "{{#issue.labels}} {{.}}{{/}}"]

but if the parent has multiple values in the Labels field, it errors out

Error creating issue - The label 'Label1, Label2, Label3' contains spaces which is invalid. (labels)

Doing this graphically works but trying to achieve it via Advance options using JSON

How do you copy a multi-value field using Advance Options in Automation Rule?

any help is appreciated


2 answers

The problem is, that you need to use the following syntax for arrays.

"fields": {
"labels": ["label_1", "label_2"]

You can achieve this syntax easy with the following smartvalues {{labels.asJsonStringArray}}

So one solution is the following code.

"fields": {
"labels": {{labels.asJsonStringArray}}

If you want to do it with the list syntax you can use the following code.

"fields": {
"labels": [{{#labels}}"{{.}}"{{^last}},{{/}}{{/}}]

With this code you enclose every label with ' " ' and seperate them with ' , '

More information about the asJsonStringArray and similar options you can find at

there is also a reference for other fields like custom fields.

About the list options the reference is at

PS: Thanks to Victor Seger from Automation for Jira for giving me the right input on my problem with a custom field.

Really helpful, thanks. But how do I add these Labels to existing labels? This currently removes existing labels

Like Erik Buchholz likes this

Hi @Daniel Oriold ,

that's right. "fields" is an alias for update > set, so you overwrite existing values. That's no problem if you create a new issue in the automation but may be, if you want to update an existing one.

If you want to add some labels, you need to use the update syntax like

"update": {
"labels": [{"add": "label_1"}, {"add": "label_2"}]

This syntax is a bit more complicated than the "fields" syntax, what makes us need to change the other code examples, too. I thought we could use the asJsonObjectArray("add") function to get it the simple way, but that doesn't give us anything.

So we need to use list syntax:

"update": {
"labels": [{{#labels}}{"add": "{{.}}"}{{^last}},{{/}}{{/}}]

Please note that this gives an error if the issue has no labels. To cover this case you could add an {"add":""} at the beginning and move the comma.

"update": {
"labels": [{"add":""}{{#labels}},{"add": "{{.}}"}{{/}}]


PS: If you like my answer, I'd appreciate if you upvote it. Thanks!

Like # people like this

Thank you very much! This was a great help :)

Hey Erik, I am actually using a custom field call 'Segment' which is a Select List (multiple choices). I want the automation to copy the values in the Segment and add them as individual Labels to the Labels field. When I do this:

"update": {
"labels": [{"add":""}{{#segment}},{"add": "{{.}}"}{{/}}]

Then I get the following Error

('Field 'labels' cannot appear in both 'fields' and 'update')

Hi @Daniel Oriold ,

the error says that you still have labels in the fields part of the JSON. Is that just the old code or do you try to do something different there?


Like Daniel Oriold likes this

Super weird. Now all of a sudden it is working. You have no idea how helpful this is to so many of our users. Thanks so much. I wish I could buy you a beer...

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events