Forums

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

Assign tickets to next unreleased fix version with 'qa' in the name

Carl January 27, 2025

JIRA automation newbie, struggling with an issue. We have releases which go from QA to Staging to Production. We create the releases a couple months in advance. When a ticket goes from Deployed to DEV to Ready to Deploy to QA state, I would like to automatically assign it to the next unreleased fix version which contains the name "qa". I can't use the "next unreleased fix version" option because I need to ensure it is the next QA fix version. I have attempted viewing multiple questions/answers in the community but I am still unable to get what I need.  I am currently trying to simply create a variable that would have the unreleased fix versions for the project, but it doesn't seem to populate. I am attaching prints of the rule and the variable definition. 

Capture.PNG

The versionList variable has the following code snippet to populate it.  The Audit Log step shows nothing when attempting to display the contents of the verionsList variable. Any help would be appreciated.

 

{{#issue.project.versions}}

    {{#not(archived)}}

        {{#not(released)}}

             {{#name.matches("qa")}}

                   {{name}},

             {{/}}

         {{/}}

     {{/}}

{{/}}

1 answer

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

Hi @Carl -- Welcome to the Atlassian Community!

First thing, I am surprised / concerned the {{issue.project.versions}} smart value actually returns those values.  The rule clearly is doing extra REST API calls to get them, behind the scenes, and that is undocumented behavior

 

If you still want to use that smart value, you could use list iteration and smart value, filtering to get the values, store them in a created variable, and then parse that to get the first one.  (Experimentation shows they are currently returned in the order of expected release, which is bottom-up on the releases page.  As this is undocumented, that could change in the future without notice.)

  • action: create variable
    • name: varVersionNamesFound
    • smart value:
{{#issue.project.versions}}{{#if(and(not(released), equals(name.toLowerCase().left(2),"qa")))}}{{name}},{{/}}{{/}}

Please update that expression based on how your actual version names.  I assumed QA is at the front.

  • some action to get the first one from the variable...
{{varVersionNamesFound.substringBeforeLast(",").split(",").first}}

 

If you want to use a documented and perhaps safer approach, your rule could call the REST API endpoint using the Send Web Request action, and exactly specify the version to return:

  • unreleased versions using the status parameter
  • version name matches using the query parameter; Again, this depends upon what you need to search.
  • exactly one version using the maxResults parameter

To do that here is the endpoint documentation: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-versions/#api-rest-api-3-project-projectidorkey-version-get

And here is a how-to article for calling an endpoint from a rule: https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

Kind regards,
Bill

Carl January 28, 2025

@Bill Sheboy , thank you for the quick response! I will take a look at the "safer" approach and let you know how that goes. 

Like Bill Sheboy likes this
Carl April 8, 2025

@Bill Sheboy , finally got a chance to get back to this. I was able to use the REST API to get versions with a certain name, which were unreleased, sorted in release date order. This made the process pretty straightforward. Thank you for the direction!!!

Like Bill Sheboy likes this
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.
April 8, 2025

Awesome; I am glad to learn that helped!

Suggest an answer

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

Atlassian Community Events