How to create a Sub-task for each added Fix version

Martin Karlsson
Contributor
February 10, 2025

What I want

A rule creating a new Sub-task when a Fix version is added to a Bug / Story (disregarding existing Fix versions in the Bug / Story), and the Sub-task should "inherit" the newly added Fix version.

If more than one Fix version is added a new Sub-task should be created for each one, and each one "inheriting" only one of the newly added Fix versions.

My rule

Main branch

Trigger: Value changes for the Fix version field.
If: JQL: issuetype in (bug, story)

Branch

For each Smart value: {{#changelog.fixversions}}{{toString}}{{/}} or {{#fieldChange.to}}{{fixVersions}}{{/}}, with Variable name: newFixVersions

Then: Create new Sub-task with Fix version: {{newFixVersions}} (and copying a bunch of other fields)

Skärmbild 2025-02-10 113143.png

The problem

As noted I've tried using fieldchange as well as changelong but none of them work, at least not the way I want it to.

{{#changelog.fixversions}}{{toString}}{{/}}

This is what I tried first and it doesn't work at all: "The provided smart value couldn't be resolved to an object".

This surprised me a bit since I actually have another rule creating new Issues when Components are added to the Bugs / Stories (one Issue per Component added) which uses changelog exactly like this and it works like a charm. So I guess there's some under-the-hood difference between the Component and Fix version fields I'm not familiar with.

Skärmbild 2025-02-10 113214.png

{{#fieldChange.to}}{{fixVersions}}{{/}}

Not quite right. It does read the changed Fix version field but goes on to create Sub-tasks for all Fix versions, i e already existing ones as well as the newly added ones.

 

Any idea on how to solve this?

2 answers

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.
February 10, 2025

Hi @Martin Karlsson 

Short answer: what you are trying may not work because of known defects with the reliability of the Fix Versions field and the changelog available to automation rules.  If you still want to try this...

Advanced Branches take a list as a source value, but the value you are supplying is a text string.  You could try storing that with a Created Variable as a comma-separated values string, and then use split() to parse the variable into a list for the branch.

I recommend starting by creating the variable and just writing it to the log, with no branch to create the issues.  After you have a changelog expression which works reliably-ish, then add the branch with the split() variable to create the issues, perhaps using either the version ID to directly set the field, or JSON with the version name in advanced edit.

Kind regards,
Bill

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.
February 10, 2025

@Martin Karlsson 

Can you try with {{issue.fixVersions.name}}?

To iterated through each version something like this is required

{{#issue.fixVersions}}

* Fix version: {{name}}, released on {{releaseDate}}

{{/}}

Suggest an answer

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

Atlassian Community Events