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.
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}},
{{/}}
{{/}}
{{/}}
{{/}}
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.)
{{#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.
{{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:
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
@Bill Sheboy , thank you for the quick response! I will take a look at the "safer" approach and let you know how that goes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome; I am glad to learn that helped!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.