Jira automation: How to copy existing FixVersions to another label?
Asked by Triet Bui Minh:

In Jira Automation, I cannot find a solution for this use case:

- Each time you change a Fixed Version (might be multiple), for example 1.2.0

- Then I need to add the label "droid_v1.2.0" to the Label field.

- If there is no Fixed Version, then just let the Label empty.

I will appreciate if someone can give me a working Automation Rule.

Edit 1 {#toc-hId--551782384}
----------------------------

I end up with such smart values:

```
{{issue.fixVersions.name.replaceAll("(\d+.\d+.\d+)", "droid_v$1").remove(",")}}
```

It works as expected:

- Set multiple versions: 12.6.0, 13.1.0, 12.6.2

- Then, the Label (Release tags) will be also added: \`droid_v12.6.0\`, \`droid_v12.6.2\`, \`droid_v13.1.0,\` (see the second screenshot)

However I notice there is a comma at the last item in the Label fields (in the below screenshot, it was named **Release tags**).

Although I add \`.remove(",")\` but it doesn't work.

Do you know why there is such comma, and what's the correct way to remove it?

![jira_1.png](https://community.atlassian.com/t5/image/serverpage/image-id/204348iF6902070907F99F3/image-size/large?v=v2&px=999 "jira_1.png")![jira_2.png](https://community.atlassian.com/t5/image/serverpage/image-id/204347i032F5C45D5BBD357/image-size/large?v=v2&px=999 "jira_2.png")


Answers:
author: Jack Brickey
body: Hi [@Triet Bui Minh](/t5/user/viewprofilepage/user-id/4031300) ,

what have you come up with so far? Below is a snippet from the Automation documentation associated with fix version smart values. If you look at the example the use {{name}} to extract the version name. You should be able to fit catenate that into the desired label. However, will you trigger this in fix version being updated? How will you deal with multiple versions? I can see the screen bit complicated possibly. Maybe a better question is why are you seeking to do add the FV as a label? Why can you not simply use the fix version? I'm sure there's a reason I just don't fully appreciate it yet.

{{issue.fixVersions}} {#toc-hId--551781648}
-------------------------------------------

Used to access the values in an issue's *Fix Versions* field. Because this smart value deals with multiple items (i.e: issues can have many fix versions), it can be used with the **#** symbol to apply the rule to each individual fix version. [Learn more about using smart values with sections and lists.](https://support.atlassian.com/jira-software-cloud/docs/what-are-smart-values/#Whataresmartvalues?-Usingsmartvalueswithsectionsandlists)

### Available properties {#toc-hId-138779826}

* {{issue.fixVersions.name}} - Returns the name of the fix version.

* {{issue.fixVersions.description}} - Returns the description of the fix version.

* {{issue.fix.Versions.archived}} - Returns **true** if the fix version is archived, and **false** if not.

* {{issue.fixVersions.released}} - Returns **true** if the fix version is released, and **false** if not.

* {{issue.fixVersions.releaseDate}} - Returns the fix version's release date. Can be combined with other date and time smart values. [Learn more about date and time smart values.](https://support.atlassian.com/jira-software-cloud/docs/smart-values-date-and-time-functions/)

### Example {#toc-hId--1668674637}

In the below example, we list each fix version that the issue has been added to, followed by the version's release date, in bullet point form.

1. `This issue is part of the following releases`
2. `{{#issue.fixVersions}}`
3. `* Fix version: {{name}}, released on {{releaseDate}}`
4. `{{/}}`
5. `// returns`
6. `This issue is part of the following releases:`
7. `Fix version: Version 1.1, released on 2019-08-10T00:00:00.0+0000`
8. `Fix version: Version 1.5, released on 2019-08-02T00:00:00.0+0000`

comments: author: Triet Bui Minh
body: Thanks [@Jack Brickey](/t5/user/viewprofilepage/user-id/853369) for these useful links.

I've updated the original question with more details, as well as the smart values which I use to update the value of **Label** field. Could you look at it again?


author: Bill Sheboy
body: Hi [@Triet Bui Minh](/t5/user/viewprofilepage/user-id/4031300)

First thing, I echo the question from [@Jack Brickey](/t5/user/viewprofilepage/user-id/853369) : what problem are you trying to solve by having both the label and the fixVersion reflect the same information?

Next, when using search/replace, regular expressions, and lists in automation rules...the audit log is your friend. Try writing the expression incrementally and writing the pieces to the audit log, step by step. That will identify what is happening.

Specifically, I suspect that your parsing is leading to an non-empty list value at the end, which could possibly be removed (for the trailing comma) with substringBeforeLast(","): <https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#substringBeforeLast-String-separator->

Kind regards,  
Bill