It always overwrites instead of adding - what has to be changed, so it does not. I tried several ways...
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/
also not working
based on https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/
For a question like this, context is important for the community to help. Please post the following:
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
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:
Issue before Automation:
Audit log says it is successful - which it is, it has set the label. BUT it also did overwrite!!!
Issue after Automation:
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
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!
It looks like you're new here. Sign in or register to get started.