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

How to copy on certain fix versions from an Epic to its child?

Patrick Cartier March 4, 2025

The Epic to child part is fairly simple.

The difficult part and one that I am struggling with currently is only copying certain fix versions from the Epic's Fix Version field.

Let's say Epic-1 has Fix Versions "ABC 2024" and "123 2024." I would like to copy only the "ABC 2024" Fix Version and not the "123 2024" Fix version.

Any ideas?

 

1 answer

0 votes
Vishal Biyani
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.
March 4, 2025

@Patrick Cartier 1 

Do you have specific rules for exclusion? if so, you can iterate through the list of fixVersions and if they match the rules for exclusion then don't append in Epic else append it.

Patrick Cartier March 4, 2025

Let's say the rule is if the fix version doesn't contains ABC then don't append it and if it does then append it.

Is that enough of an exclusion rule?

Vishal Biyani
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.
March 4, 2025

Iterate over fixVersions

{{#issue.fixVersions}}

if(name.match("*(ABC)*"), <True do something>, <False do other logic>)

{{/}}

 

see if this works for you

Patrick Cartier March 5, 2025

For the true and false sections, how would I copy that specific fixversion name if true and do nothing at all if false?

Vishal Biyani
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.
March 6, 2025

@Patrick Cartier 1 

Here is my proposed solution. see if this works for you.

As a trigger I have used Manul trigger. You can use as per your use case

1)

Create smart variable say varFilteredFixVersions. This creates a json object for matching fixVersions that need to be copied to child issue from epic.

{{#issue.fixVersions}}

{{#if(name.indexOf("ABC").eq(-1))}}

{"name": "{{name}}"},

{{/}}

{{/}} 

2) Create a branch for Children

3) Then Edit issue select fixVersions to edit and in the advanced edit code box, put

{
"fields": {
"fixVersions": [ {{varFilteredFixVersions.substringBeforeLast(",")}} ]
}
}

Patrick Cartier March 6, 2025

The result here is {"name": "non-abc fixversion"}

Vishal Biyani
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.
March 6, 2025 edited

varFilteredFixVersions.substringBeforeLast(",") would have something like that.

So all the fixVersions in Epic and doesn't contain ABC, will be/should be added in child stories/task

if you need to reverse i.e. only copy where ABC is present then change eq to gt and that should work

{{#if(name.indexOf("ABC").gt(-1))}}

Patrick Cartier yesterday at 12:07 AM

The reverse works well for my case, but right now it is still printing 

 

{"name": "ABC fixversion"}

 

Vishal Biyani
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.
yesterday at 12:27 AM

can you share the screenshot of the automation that you have?

and where it is breaking

so, if you have fixVersions like "ABC 2024", "123 2024", "2025 ABC" in the epic then ideally both "ABC 2024" and "2025 ABC" should get copied to child.

Patrick Cartier yesterday at 1:01 AM

The error I am currently getting is 

Unable to find any issue field values to edit:

This is the JSON for settings fixversion 

{

"add": {

"fixVersions": [

{"name": "{{varabcfixversion.substringBeforeLast(",")}}"}

]

}

}

And this is the code for the variable creation (varabcfixversion)

{{#issue.fixVersions}} {{#if(name.indexOf("ABC").gt(-1))}} {{name}}, {{/}} {{/}}  

 With an audit entry immediately after, I can print the correct fixversion

{{varabcfixversion.substringBeforeLast(",")}}

 But I get the error I mentioned above.

Vishal Biyani
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.
yesterday at 1:22 AM

this is the automation that I wrote. In the edit action, assumint you selected fixVersion field, i see the use of json in Additional fields may not be correct.

Can you try with what i have in screenshot i.e. additional fields text box should look like

{
"fields": {
"fixVersions": [ {{varFilteredFixVersions.substringBeforeLast(",")}} ]
}
}

 

snip.png

Patrick Cartier yesterday at 1:27 AM

@Vishal Biyani leaving the field blank like that clears the value. We can't have both the field and the advanced edit.

Vishal Biyani
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.
yesterday at 1:31 AM

No. it doesn't. Otherwise, there is no purpose of Advanced fields.

You need to select the field as far as i know. Otherwise, automation will give the error that you are seeing.

Try it out with one test issue that you may have and see how it goes.

Patrick Cartier yesterday at 1:53 AM

I did, and it clears the value when I do that.

I am getting closer with this though, but it adds a space " " before the fixversion

Any ideas?

{
"fields": {
"fixVersions": [
{"name":
"{{varabcfixversion.substringBeforeLast(",")}}"
}
]
}
}
Vishal Biyani
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.
yesterday at 3:03 AM

not sure why a space will get added. How can you try using trim() to see if removes the leading and trailing spaces.

if this does not do the problem, check if there is an extra space added somewhere by mistake?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, team '25, conference, certifications, bootcamps, training experience, anaheim ca,

Want to make the most of Team ‘25?

Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.

Learn more
AUG Leaders

Upcoming Jira Events