Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Jira Automation: Assigning a fix Version based on Component Edited

Hi gents,

I am strugling to find working solution for assigning a fix Version to resolved issue. The assignment should be based on component, as there are always two unreleased versions active - one for each component within the project.

The rule should check value of field "Resolution" during issue transition and for resolved issues (Resolution = Done) assign corresponding fix Version based on component.

"Edit issue" action does not allow me to set "Fix versions" to match pattern / regex. There is an option to specify additional field values to be set using a JSON object, but i was not able to find any example of pattern / regex usage within JSON in the documentation: 

https://support.atlassian.com/jira-software-cloud/docs/advanced-field-editing-json/

To clarify the issue a bit more:

  • there are two components in the project - "ABC" and "DEF"
  • there is a unreleased version for each component with naming convention [component] YYMM, i.e. "ABC 2108", "DEF 2108"

Any idea, help or guidance will be appreciated.

Thanks,

Igor

1 answer

Hi @Igor Strba 

You can edit an issue's fixVersion field, setting it to a smart value expression.  When you select the field, just type in your expression.

And, assuming there is only one value in components, you can use your {{issue.components.name}} and add on your date information to build the version name for assignment.  When there are more values in components, you will need to use list functions to first extract the value you want to use.

What you cannot do from smart values: look up in a list of versions to find one matching an expression.  You will need to build the version name based upon other information, such as the current date/time.

Please look here for some information to get you started.  If you get stuck writing your rule, please post and image of your rule, the audit log, and what you believe is not working as expected.  Thanks!

https://support.atlassian.com/jira-software-cloud/docs/smart-values-general/
https://support.atlassian.com/jira-software-cloud/docs/smart-values-lists/
https://support.atlassian.com/jira-software-cloud/docs/smart-values-text-fields/
https://support.atlassian.com/jira-software-cloud/docs/smart-values-date-and-time-functions/

Best regards,
Bill

Hi @Bill Sheboy ,

Thanks for fast response.

I am afraid that i can not "build" the version name as it is predefined - four releases per year (February, May, August, Novmber), i.e. "ABC 2108", "DEF 2111", "ABC 2202", etc...

Key is to look up in the list of unrleased versions and select correct one by matching an expression (pattern) defined by {{issue.components.name}}. Thats where i am stuck as I was not able to find any example of pattern / regex usage within JSON in the documentation.

Best regards,

Igor

Hi Igor,

Other than a potential Y3K problem :^)  I expect that if these two assumptions are valid:

  • you create the versions before you need them, and
  • the work is done *during the quarter for the release version* that...

You could build the version name from the component and {{now}} with the text and date functions.

{{issue.components.name}} {{now.jiraDate.remove("-").substring(2,6)}}

How this works:

  1. grab the component name, adding a space after it
  2. grab the current date/time
  3. convert the date time to jiraData format: 1979-11-01
  4. remove any dash characters
  5. and grab just the last 2 digits of the year and the month

Then, just past that expression in when editing the fixVersion field. 

Restating my first comment, the smart value functions can help quite a bit...it often just takes some experimentation to get what you want.

Hi Bill, 

Thanks for the advice with chaining the smart value string functions. 

The automation rule is triggered when resolution is set to "Done" which can be up to three months before actual release - i.e. issue resolved on 13th of May will be in August release.

Key is to look up in the list of unrleased versions and select correct one by matching an expression (pattern) defined by {{issue.components.name}}. Thats where i am stuck as I was not able to find any example of pattern / regex usage within JSON in the documentation.

Best regards,

Igor

Hi Igor, and thanks for clarifying your use case.

At this time, there does not appear to be a way to access a list of a generic data entity (e.g. Version) which is not associated to an issue.  You can get such things as the version list from the REST API, and that can be called from an automation rule.  However...

Here is what I still do not understand: how do you know which version to assign to from the issue?  You posted:

The automation rule is triggered when resolution is set to "Done" which can be up to three months before actual release - i.e. issue resolved on 13th of May will be in August release.

There must be some piece of data in the issue to identify the release date, correct?  If so, you could use that and the component to build the value to set in the fixVersion.  If instead there is no value stored in the issue I do not see how this is possible to select the correct version.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
Community showcase
Published in Trello

🏊‍♀️ Atlympic Event: Trello

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

34 views 0 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you