Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,803
Community Members
 
Community Events
165
Community Groups

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

2 answers

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.

I'm running into the Same Issue - it would be really great if we could just add a component to a release. that would easily solve my problem.

I was hoping to be able to look at a list of unreleased versions and pick one based on the component.
eg; we use platform components iOS and Android
When I create releases we put the component in like so

[iOS] 1.2.3
[AND] 2.1.3

These are never really in synch and release semvers are set depending on the type of work completed in any given sprint/initiative - this sprint is may be a patch or a minor version bump, next sprint it may be a major release. So these cannot really be generated through scripting.

Any thoughts of adding a component field to a release? That would solve this easy peasy.

Hi @Paul Cottrell 

At this time, I do not believe you can associate extra data with a release and out-of-the-box Jira.  You may want to check the marketplace for apps to enhance release management.

Your work-around of adding the component's name to the version name can work, but you cannot search for those with JQL until issues are assigned.  The other way to get at the releases is using the REST API from the automation rule, as I noted earlier to Igor.

Kind regards,
Bill

Late to the party, but why replicate the component value in the fixVersion field? You can filter the tickets based on the component and fixVersion fields. I'd leave them separate.  Just my $0.02.

Suggest an answer

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

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

14,905 views 37 49
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