Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Assigning Fix version based on custom date field

Albert Kim-Darov
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 21, 2022

Hello,

Using automation, I would like to assign that fix version where the a custom date field's value is between the end and start dates set for the the version.

I feel like this is not possible as lists are not supported, but was wondering if someone has an idea how to do this?

My example would be in case of 3 versions.

Version 1: Start date March 21, Release date March 27
Version 2: Start date March 28, Release date April 3
Version 3: Start date April 4, Release date April 10

If on edit I assign the Custom Field "Calendar Start Date" to be March 22, then Version 1 should be assigned to Fix Version.

Thanks for any help in advance!

1 answer

1 accepted

0 votes
Answer accepted
Ste Wright
Community Champion
March 21, 2022

Hi @Albert Kim-Darov 

Are you using Automation for Jira?

If so, I'd suggest something like...

  • Trigger: Field Value Changed - Calendar Start Date
  • Condition: If/Else Block
    • Sub-Condition: JQL Condition
      • JQL: "Calendar Start Date" > 2022-03-20 and "Calendar Start Date < 2022-03-28
    • Action: Edit Issue - Fix Versions: Version 1
  • ...etc

^ Using this as the baseline for your rule, you could keep adding additional If/Else sub-conditions to fulfil each of your needs.

 


A few notes on this approach...

  • If the date changes...
    • ...and the version remains the same, check this doesn't re-activate the rule (which could be annoying, if you rely on the date of Fix Version edits for any reason). If it does, an additional Condition prior to an Action could be to check the Version doesn't already equal the Version to be set.
    • ...and it's a different version, what should happen? Should the existing version be replaced, or added to? You'll need to test this, depending on the need.
  • For date ranges, I've used < and > operators - to ensure it captures the whole day from both ends. You can test using >= and <= also - I just find my method is a little more absolute at times.

 


Let us know if this helps, and if you have any other questions, or need help with the formatting of the automation rule in full, let us know!

Ste

Albert Kim-Darov
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 29, 2022

@Ste Wright , thanks a lot! I did an automation for this and it worked. Initially I looked for something more dynamic, but this did the trick as well.

Since I can have only one version assigned, I always clear the version at step one. My current problem is that I have a limited set of conditions that can be set in Jira automation but this can be stepped over by updating the code periodically.

Your solution got me thinking and here is my new, more dynamic solution that works if your fix versions start on Monday and end on Sunday:

- Created a custom text field and called it "Version preset".

- On issue creation, I set this custom text field in project automation with the preset I want in that project (FYI, I want differentiation in version name per project). In our case, if I set my versions to be called Test 22 Week 1, Test 22 Week 2, Test 22 Week 3... - this preset would be "Test 22 Week ".

- After this, I set an automation rule on Calendar Start value change Trigger to edit Fix versions as the following: 

{{issue.customfield_12801}}{{issue.customfield_12502.weekOfYearIso}}

Customfield 12801 is my custom text field, customfield 12502 is Calendar start.

This has a strong dependency that the Version are actually following the week of the year setup, but it works and is dynamic.

The only dependency here is now to set the automation for version preset for each project.

Thanks a lot, you got me thinking and found solutions! Cheers! :)

Like Ste Wright likes this
Ste Wright
Community Champion
March 29, 2022

Hi Albert,

Glad you found a solution most suited to your needs!

And thanks so much for explaining it in detail for the Community - this will help others with this need in the future!

Ste

Suggest an answer

Log in or Sign up to answer