Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Set issues fixed versions automatically

Paul Dokken
Contributor
March 23, 2022

I just started using Releases and versions in my JSW project.  When I transition an issue to DONE I would like the Fix Versions to be set to the latest unreleased version.  How would I do this?

3 answers

1 accepted

3 votes
Answer accepted
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 23, 2022

Hi @Paul Dokken 

You may do that with an Automation for Jira rule.  For example:

  • trigger: issue transitioned to Done
  • condition: Fix Versions field is empty
  • action: edit issue to set the Fix Versions to the "Next unreleased version"

You could remove the condition if you want to replace any existing value.

To learn more about automation rules, please look at these sources and examples:

 

Kind regards,
Bill

Paul Dokken
Contributor
March 24, 2022

Perfect!  This is exactly what I was looking for.  Thanks so much for sharing your knowledge.

Like Bill Sheboy likes this
Salim Ubeydullah January 26, 2023

Follow up question, 

 

How can I set the fixVersion not to the next Unreleased version, but to the one right after?

Also, is it possible to read the {{pullRequest.destinationBranch.name}} variable, parse it and dynamicly set the fixVersion?

Example: If the branch is develop, I want to set the version to 1.1.0
If the branch is release-1.0.0, I want to set the version to 1.0.0

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.
January 27, 2023

Hi @Salim Ubeydullah -- Welcome to the Atlassian Community!

The short answer to your first question is: probably not.  Smart value lists do not have the ability to be sorted, and so you cannot find the "one before the next one".

For your second question, the answer is "yes".  A version can be set from the drop-down list or from a smart value expression, and so you would create an expression to get that version number from the branch name to use it.

Kind regards,
Bill

Salim Ubeydullah January 27, 2023

Thanks, yes I tried the second option and it works.

My third solution is to have a label set on the PR, that matches a release version name in JIRA, grab that and set it as the release version. Is that doable?

is there a smart variable like {{pullRequest.labels}} ?

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.
January 27, 2023

Based on the documentation, those labels may not be available: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-development/#--Pull-request--

However...everything possible is not listed in the documentation.  So I recommend making a test rule which is triggered to access a PR, and then write the contents to the audit log (or email them to yourself) as JSON to see what is available for access.

Salim Ubeydullah January 27, 2023

Ok, Since Labels is probably an array, what would be a good guess to try to set the fixVersion to all the label, then JIRA will only pick the ones that matches an existing Release name?

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.
January 27, 2023

Did you confirm the labels are available?

And if you are trying to set multiple versions based upon data, such as from the fields, you would need extract the labels, expand the list, and then format them for advanced edit with JSON, as described here: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#Fix-Versions

0 votes
Paul Dokken
Contributor
March 30, 2022

jira audit log.jpg

Here is the audit log.  The 20 that I mentioned should meet the condition that all are transitioned to done and Fix Versions is empty. The reason I have the rule global is I want it to run on both my software projects which each have their own Fix Versions.  

0 votes
Paul Dokken
Contributor
March 29, 2022

I thought it was working but has only worked on 2 issues out of about 20 that have already been done.  I have made sure the scope is set for the project.  Any ideas?

Jira automation.jpg

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 29, 2022

Hi, Paul.

When you note it only worked on 2 issues out of 20, what are you observing happening? 

Can you post images of the audit log details showing executions where it worked and did not work as expected?

Next, I notice you have set this up as a global scope rule. 

  • Is that intentional or do you just need this for one project? 
  • The reason I ask is that versions are set up by project, and so I wonder if something in the edit is not working as you expect when versions are not set up for a project.  What I would expect for that case is the Fix Version is cleared in that case.

Kind regards,
Bill

Paul Dokken
Contributor
March 30, 2022

Hi Bill,

Here is the audit log.  The 20 issues that I mentioned should have met the condition of transitioning to done and Fix Versions is empty to only 2 ran.  

The reason I made the rule global is that there are 2 software projects and each of them have their own Fix versions.  

jira audit log.jpg

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 30, 2022

Thanks for that info, Paul.

According to the audit log, the rule seems to be triggering for only one project: FSO.  Were there other issues for that same project which did not trigger the rule?

And, are these Company-managed or Team-managed projects?

I ask because the "Done" status for company-managed project is probably a shared/reused status in your Jira site.  For team-managed, each project has its own set of status values.  So perhaps the rule is not picking up one of them for the project.

If one (or both) projects are team-managed, you can check this by copying the rule to one of the projects, disabling the global rule, and see if the project-specific rule works as expected.

Paul Dokken
Contributor
March 31, 2022

FSO is a team managed project.  The scope is now just for software projects.  I am wondering if I need to have the Check to allow other rules... checkbox checked since I have an automation that moves the status to to done. automation.jpg

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 31, 2022

Ah...yes, you do.  The "Allow rule trigger" option does that.  The default is disabled to prevent a runaway rule/looping condition, and in your case you want one rule to trigger another.  Sorry I missed that!

Like Paul Dokken likes this

Suggest an answer

Log in or Sign up to answer