Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Add fixversion as label using Automation, without changing/removing existing labels

M0214104
Contributor
June 5, 2025

It always overwrites instead of adding - what has to be changed, so it does not. I tried several ways...

 

05-06-2025_15-55-56.jpg

3 answers

1 accepted

0 votes
Answer accepted
Fazila Ashraf
Community Champion
June 6, 2025

Hi @M0214104 

Replace the smartvalue in your screenshot with {{issue.fixVersions}}

Additionally refer to 'To edit the field without overwriting its original content:' section of https://support.atlassian.com/automation/kb/how-to-update-a-select-field-multiple-from-the-content-of-other-fields/ 

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 5, 2025

Hi @M0214104 

For a question like this, context is important for the community to help.  Please post the following:

  • what version of Jira are you using: Cloud, Server, or Data Center
  • for Cloud, what type of project is this: company-managed, team-managed, JPD, etc.
  • an image of your complete automation rule in a single image for continuity
  • images of any relevant actions / conditions / branches
  • an image of the audit log details showing the rule execution

Until we see those...

The Fix Versions field has a list of values in the smart value {{issue.fixVersions}}

https://confluence.atlassian.com/automation/jira-smart-values-issues-993924860.html#Jirasmartvaluesissues-issue.fixVersions

Thus you may need to use advanced edit with JSON to add the values from that list:

https://confluence.atlassian.com/automation/advanced-field-editing-using-json-993924663.html#AdvancedfieldeditingusingJSON-Addinglabels

And, you do not describe what is in your version names.  For example, if there are spaces those will not work with labels.  They need to be replaced, such as with underscores.

 

Putting that all together, you could use this dynamic JSON expression to add the labels:

{
"update": {
"labels": [
{{#issue.fixVersions}}
{
"add": {{name.replace(" ", "_").asJsonString}}
}{{^last}}, {{/}}
{{/}}
]
}
}

Please adjust this based on the actual content of your version names.

 

Kind regards,
Bill

0 votes
M0214104
Contributor
June 5, 2025

also not working

05-06-2025_15-58-26.jpg

M0214104
Contributor
June 6, 2025

Hi @Bill Sheboy and @Fazila Ashraf 

We're on Data Center.

Our Release Versions contain an underscore, e.g. PI_25Q4W

I have changed the smartvalue as the additional information, as given above.

Image of the complete automation:

06-06-2025_12-11-24.jpg

Issue before Automation:

06-06-2025_12-13-26.jpg

 

Audit log says it is successful - which it is, it has set the label. BUT it also did overwrite!!!

06-06-2025_12-16-05.jpg

 

Issue after Automation:

06-06-2025_12-14-59.jpg

 

Why does it do this? It's so not logical, in a bulk change it is possible to add and still have the labels from earlier on.


Thanks so much for your help :)

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 6, 2025

When using the Edit Issue action, a field may be selected from the dropdown list or updated using JSON with "additional fields"...but not both in the same action.

And...I note you changed the dynamic JSON to use both single and double-quotation marks.  That will not work, and it is why I used the asJsonString function:

{{name.replace(" ", "_").asJsonString}}

 

If you are certain your version names will never contain spaces, you may simplify what I suggested earlier to remove that logic:

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

AND, I fixed a typo from my earlier post as it was missing the pound sign # in the iterator.  Please add that to your expression.

 

Please deselect the field from the dropdown list, update the expression, and re-test.  Thanks!

M0214104
Contributor
June 12, 2025

Hi @Bill Sheboy 

You did magic!!!!! It worked - thank you so much :-D

I was not aware that you cannot have both, the "add" and the "additional" one at the same time. 

Thank you also for your simplified code - yay! My users will be so happy!

Kind regards
Kathrin

Like Bill Sheboy likes this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 12, 2025

Awesome; I am glad to learn it is working!  Please consider marking this question as "answered" to help others with a similar need find solutions faster.  Thanks!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events