Automate fix version by name and update a field with release date

Núria Rull Bassols March 19, 2024

Hi! 

I want to set up a rule that when an issue is added to a sprint, if that issue is for an "on-prem" deployment type, I need to inform the "fix version" field with the version that starts with X and also inform a field "planned released" with the "release date" of the version release added.

The project where those issues reside is a multi-product project, so different releases belong to other products. I want to filter the release version by the earliest one that starts with X and inform a "customfield_10084" with the release date.

I've managed to add the version, but not filtered by the "X" name, and I don't know how to do it. I also cannot get the release date in the custom field. I used: {{issue.fixVersion.releaseDate}} but do not work. :S

 

I would appreciate your help. 

 

1 answer

1 accepted

0 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 19, 2024

Hi  @Núria Rull Bassols 

For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected.  Those will provide context for the community to offer ideas.  Thanks!

Until we see those...

To filter the versions, you could try smart value, list filtering: https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588

Regarding the release date value, does your issue contain multiple fix versions?  If so, the smart value you should could be producing a list of values, separated by commas.  Once you filter to one value the date set should be correct.

Kind regards,
Bill

Núria Rull Bassols March 19, 2024

Screenshot 2024-03-19 at 18.53.41.png

Núria Rull Bassols March 19, 2024

The current issue does not contain any fixed version; I want to add the next release version (unreleased, specifically the one that starts with "SLM") because the project contains different products. 

Also, I need to update the planned release field with the release date of the version added. 

Let me know if that is enough for you. I used the smartvalue: {{issue.fixVersion.releaseDate}} 

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 19, 2024

Context is important for automation rules, so please show images of:

  • your complete rule, in one image
  • the audit log details showing the rule execution

 

Where have you tried to filter the version value before setting it?

Núria Rull Bassols March 19, 2024

Hi @Bill Sheboy I've added a JQL but do not work. Not sure how to do it. This is the last error, and the screenshots of the rule. The first part is working fine, it is only the second part with the "on-prem" scenario.

Screenshot 2024-03-19 at 20.05.12 1.pngScreenshot 2024-03-19 at 20.00.43.png

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 19, 2024

With the Release Version action, an exact name must be given.  It cannot search for a name using the CONTAINS ~ operator, like with JQL.

 

Based on what you described, you are trying to release the version assigned to the issue which has a name start containing the text SLM, and which is not yet released.

As the fix version field can contain multiple values, that will require multiple steps before the release action:

  • action: create a variable to hold the name and id data for the versions
    • name: varVersionData
    • smart value: {{#issue.fixVersions}}name:{{name}};released={{released}};id:{{id}}{{^last}},{{/}}{{/}}
  • action: release the version with the selected name, using its id value
    • {{varVersionData.split(",").match("(.*SLM.*released=false.*)").match(".*id:(.*)").distinct}}

 

The first smart value for the variable works by iterating over the fix version field, saving any name, released status, and id values in a delimited list.

The second one splits the variable back apart, filtering on the name and released status first, and then extracting the id value for the version.

This technique will not work if there are multiple versions containing "SLM" assigned to the same issue.

Núria Rull Bassols March 19, 2024

Thank you for the answer, although I may not have explained what I wanted to do. 

I do not want to release any version; I want to add the version to the issue that triggers the rule, and use the "release date" of that version to populate a custom field named "planned released." 

As you mentioned, there is no way I can filter the release by the name and add the right one to the issue. 

I may have to think of another way to accomplish that.

Núria Rull Bassols March 19, 2024

I've tried your approach, and the result was that a "version release" was released but not added to the issue. Screenshot 2024-03-20 at 00.03.32.png Screenshot 2024-03-20 at 00.04.21.png

Núria Rull Bassols March 20, 2024

I've managed to add the version (specific one) but not to add the {{issue.fixVersion.releaseDate}} to the custom field. my JSON is not right, I guess

Screenshot 2024-03-20 at 12.47.51.pngScreenshot 2024-03-20 at 12.48.04.png

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 20, 2024

If you did not want the rule to release a version why did your rule use the Release Version action?  That does not seem to match what you are now describing as the need, or the original question.

 

The latest rule you show appears to have a specific version selected, "SLM 9.34.0", and to select the "Next unreleased version".  That cannot work in a rule as it is trying to edit the same field twice: fix versions.

That approach also does not match what you described as the original question.

 

With the unclear nature of the problem you are trying to solve, I have two recommendations:

  1. Meet with a member of your team, and describe the problem you are trying to solve and "why" it needs to be solved.  That will help you confirm your understanding of the problem.
  2. After that, contact the Atlassian Support team to ask for their assistance: https://support.atlassian.com/contact/#/  As you are the site admin for a premium Jira license, you should be able to submit a support ticket.

 

Núria Rull Bassols March 20, 2024

Hi @Bill Sheboy 

I did a mistake using the release action, that's why I requested help, because I cannot get what I'm trying to achieve. 

The original question was and still is:

"I want to set up a rule that when an issue is added to a sprint, if that issue is for an "on-prem" deployment type, I need to inform the "fix version" field with the version that starts with SLM and also inform a field "planned released" with the "release date" of the version release added.

The project where those issues reside is a multi-product project, so different releases belong to other products. I want to filter the release version by the earliest one that starts with SLM and inform a "customfield_10084" with the release date."

1. Inform the fix version field with the next unreleased version for SML (in that project there are other releases different than SLM).

2. Use the fixversion.releasedate to populate a custom field named "planned release"

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 20, 2024

As you want to find a specific, unreleased version and then assign it to the issue, your rule could do this:

Using the Send Web Request action, call the REST API function to search for the version, and then use both the id and release date values.

An example search would be this:

<your Jira URL>/rest/api/3/project/SIT/version?query=SLM&status=unreleased

This would search in your project SIT, for an unreleased version with SLM in the name or description.  Please update that if the project is not named SIT.

Assuming only one result is found, the values in the response for the version id and release date would be:

{{webhookResponse.body.values.id}}
{{webhookResponse.body.values.releaseDate}}

 

Here are the references needed to implement this rule:

https://community.atlassian.com/t5/Jira-Software-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-versions/#api-rest-api-3-project-projectidorkey-versions-get

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--webhookResponse--

Núria Rull Bassols March 21, 2024

Thanks a lot, @Bill Sheboy . I appreciate your help. 
It is proving to be quite a challenge for me as someone without an engineering background. I'll need engineering support.  I find it difficult to understand JSON, and this REST API is a bit more complex. 

Núria Rull Bassols March 21, 2024

I've managed to get a JIRA token and follow the instructions that you provided. But without an understanding of the language it is too complex:

Screenshot 2024-03-21 at 14.36.51.png

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 21, 2024

No worries; we are all learning.  A few adjustments to your call to the REST API...

For that function, do not pass any data for the Send Web Request action:

  • the HTTP Method should be Get
  • the Web Request Body should be Empty

Please re-read that how-to article as your header is incorrect:

  • The key should be:
    • Authorization
  • The value should be:
    • Basic yourEncodedToken

The results of the call will be in the {{webhookResponse}} smart value.  The smart values I noted are the ones which will contain what you wanted.

Suggest an answer

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

Atlassian Community Events