Jira Automation: Copy linked issue's Fix Versions to triggerIssues Affects Versions field.

Jonny March 10, 2025

Hey, I'm planning a trigger automation to pull out the Fix Versions from the triggerIssue's linked issues and then add those Fix Versions to the Affects Versions of the triggerIssue. Screenshot 2025-03-11 at 2.06.11 pm.png

I'm getting stuck quite early, I can't seem to format the values coming from lookupIssues well enough. Nor can I get the formatting of the advanced editing action to be right.

As well as I'd need to consider multiple linked issues, and multiple fixVersions too. 

Am I overthinking this? 

 

Thanks, any help is plenty appreciated.

2 answers

1 accepted

5 votes
Answer accepted
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 10, 2025

@Jonny 

FixVersion and Affects Versions are a list field.

You can start by creating a variable and create a json string of matching fixVersions like this

{{#lookupIssues.fixVersions}} {"name": "{{name}}"}, {{/}}

Then when you edit the fixVersion use something like

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

see if you are able to make progress with this logic

Jonny March 10, 2025

Thanks so much Vishal.

 

Works like a gem. 

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.
March 11, 2025

Hi @Jonny 

When trying to extract the distinct versions from a Lookup Issues result, please consider that the Lookup Issues result is a list of issues and the Fix Versions field is a list.  Thus a list of lists will appear like this: [version A, version B], [version B], [], [version C]...  Adding that directly will attempt to add duplicate values to the Affects Versions field or fail in the JSON.

 

To extract the distinct values spanning all of the issues in the lookup result, the newly revealed flatten function may be used with the distinct function:

{{lookupIssues.fixVersions.name.flatten.distinct}}

That list may then be iterated to create a dynamic JSON expression to add them:

{
"fields": {
"versions": [
{{#lookupIssues.fixVersions.name.flatten.distinct}}
{
"name": "{{.}}"
} {{^last}},{{/}}
{{/}}
]
}
}

 

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events