Question about automation settings for fix versions

Ekaterina Zvereva January 29, 2024

Hello community! I have an issue with Jira automation. I set up the rule: when issue status transition to "in progress" then edit issue field fix version (next unreleased version)
But I have a few versions now. So... 
And when automation works it just deleting that version which I set up by myself and setting up next unreleased version. How can I set up a rule so that it doesn't delete the second version that I put on it?

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.
January 29, 2024

Hi @Ekaterina Zvereva 

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...

Are you trying to add a release / version to the existing values in the issue?  If so...

I believe rules can use those relative versions (e.g., Next Unreleased Version) to SET the Fix Version, or they can COPY from another issue and add to the existing versions.  But they cannot do both.

I suspect a work-arounds is possible, such as with Advanced Edit with JSON and created variables:

  • save the current versions in a variable
  • SET the version to the Next Unreleased Version
  • re-fetch the issue
  • use JSON to add additional versions from the variable

Kind regards,
Bill

Ekaterina Zvereva January 29, 2024

Hello @Bill Sheboy

Thank you very much for your answer.

Here it is, my rule and history about how it works image.pngimage.pngimage.pngimage.png

Ekaterina Zvereva January 30, 2024

@Bill Sheboy by JSON I did this, but as I understand I should every time change name of version in this rule image.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.
January 30, 2024

Thank you for that information.  Focusing on the original rule first:

Looking at the audit log from your rule execution, I see only one Edit Issue result, indicating there was no parent issue to branch to.  Is that what you expected for the issue CARGO-5488?

 

Also...

  • If you navigate to the rules list,
  • select the complete audit log,
  • look for any other rules which ran at the time of the issue transition,
  • do you see other rules which may have changed the issue?

Given what appears to be the change history for issue CARGO-5488 there are at least 2 rules running on that issue after the transition: one changing the Fix Version and another changing the Sprint.

Ekaterina Zvereva January 30, 2024

I have two similar rules set up, one for automatically transferring a task to a sprint, the second for automatically assigning a version to a task. 

And I expected that the version that is already specified in the task will not be deleted by this second rule which I attached above. 

I don't see a problem in the logs. And I solved the problem thanks to your hint with JSON :)
image.png

Now two versions are displayed in the field and the one that was already in the task is not deleted. But now I need to change the version name in the script at the time. Otherwise, the task will always be assigned version 0.6.11

So this method partially solved my problem, but didn't fully automate the process.

 

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

Would you please post an image of your current rule and the audit log details?  That will help to decide next steps.  Thanks!

Ekaterina Zvereva January 31, 2024

@Bill Sheboy 

Sure, here it is! Current audit logs and rule detailsimage.png

image.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.
January 31, 2024

Thanks, and that shows your rule can successfully add a hard-coded version to the existing ones.  But you want to add the "Next unreleased version by release date".

There are a couple of ways to do this: two updates or one update using data from the REST API functions.  The second one is more difficult, so let's try the first one...

 

The idea is to save the current value for the version in a created variable, set to the next unreleased, and then add the saved value.  I will add italics where there are changes for your rule:

  • trigger: issue transitioned
  • branch: to parent
    • action: create variable
      • name: varVersionName
      • smart value: {{issue.fixVersions.name}}
    • action: edit issue, setting the Fix Version to "Next unreleased version by release date"
    • action: re-fetch issue (This reloads the data so we can add to it, and slow the rule down a bit.)
    • action: edit issue, with JSON to set the field.  The JSON is different now...
{
"update": {
"fixVersions": [
{
{{#varVersionName.split(", ")}}
"add": { "name" : "{{.}}" }{{^last}}, {{/}}
{{/}}
}
]
}
}
  • action: edit issue (i.e., the trigger issue)

 

This should work even when there are multiple, existing versions in the parent.  How that expression works is:

  1. split up the variable, as the names were added with a delimiter
  2. iterate over that list of names
  3. adding the section to "add" each one (The {{.}} represents the list item.)
  4. and conditionally add a comma at the end of each line (The last one is left off to prevent JSON errors.)

 

Ekaterina Zvereva February 1, 2024

@Bill Sheboy Thank you very much! It works!! 

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.
February 1, 2024

Awesome; I am glad to learn that helped!

Now a recommended next step: please explain this rule to another team member, ensuring you both understand how it works.  That will improve rule knowledge and readiness for maintaining the rule.

Like Ekaterina Zvereva likes this

Suggest an answer

Log in or Sign up to answer