Hi all
I've scoured the source material and google - it's been several hours and I can't get this to work.
I want to automatically set the start and due date to the beginning and end of a quarter based on the summary string.
For example, "Q3 Reviews" would set the start date for July 1st and end date for Sept 30th.
The IF condition is working fine, but my code is failing to update the start and due date. The audit log states the rules ran successfully and edited the issue.
Start date:
{{#switch}}{{issue.summary.match('Q1') ? now.format('YYYY') + '-03-31'}}{{issue.summary.match('Q2') ? now.format('YYYY') + '-06-30'}}{{issue.summary.match('Q3') ? now.format('YYYY') + '-09-30'}}{{issue.summary.match('Q4') ? now.format('YYYY') + '-12-31'}}{{/switch}}
Due Date:
{{#switch}}{{issue.summary.match('Q1') ? now.format('YYYY') + '-06-30'}}{{issue.summary.match('Q2') ? now.format('YYYY') + '-09-30'}}{{issue.summary.match('Q3') ? now.format('YYYY') + '-12-31'}}{{issue.summary.match('Q4') ? (now.format('YYYY') + 1) + '-03-31'}}{{/switch}}
I have also tried using wildcards e.g. "issue.summary.match('Q1.*')"
Can anyone point me in the right direction?
Okay I eventually figured out the correct JQL and smart values to use to get this right. So the condition for checking if the issue created date is after the first day of March (current year) is:
{{issue.created >= (now.withMonthOfYear(3).startOfMonth())}}
So to check whether a task created should be assigned to this years quarter (e.g. Q1) or next years based on the created date now works! :)
Welcome to Atlassian community!
This is what I did when creating the automation rule:
I am enclosing the screenshot for your reference.
Hope this helps.
Thanks,
Vamsi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks so much!
Thats working perfectly! I'm experimenting now with trying to add conditions to check if the quarter variable is in the future, and if so move the start and due dates to next year.
So far it's setting all of my dates to next year to I havent quite figured that part out yet!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad that it worked out.
Good to know that you are trying to enhance the logic. Sorry, I did not quite follow the condition based on your automation rule screenshot.
If you don't mind, can you provide a brief example about what you are looking for so that I can provide you a solution?
Thanks,
Vamsi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks!
So in trying to set the start/due date according to the quarter in the title, e.g. Q2, I also want to set a condition to check if the current date is after the end of Q2.
But even though we havent reached Q2 yet, the issue is still setting the start/due dates to next year.
If Block:
Issue Fields Condition:
Summary contains Q2
and
JQL condition
{{issue.created >= now.withMonth(6).endOfMonth()}}
Then
Edit Issue Fields:
Start date
{{issue.created >= now.withMonth(6).endOfMonth()}}
Due date
{{issue.created >= now.withMonth(6).endOfMonth()}}
Else
Issue Fields Condition:
Summary contains Q2
Then
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To be clear, let me clarify this.
Supposing the ticket was created on July 14th 2023. This falls in Q2 and is between the dates 06/30/2023 and 09/30/2023.
So, since Q2 already started for this year, you want to set the Start Date and Due Date for this ticket as 06/30/2024 and 09/30/2024 respectively. Am I correct?
Or, like we are in Q4 now. So, any ticket that gets created today will have the Start Date as 12/31/2023 and Due Date as 03/31/2024?
Thanks,
Vamsi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thats exactly it! :)
My GRC tool sends tasks to Jira as soon as the old one is done, so quarterly scheduled tasks appear in the same period if I dont check for this.
Even so, I still want to keep the flexibility of scheduling new tasks for a given quartner and not have them automatically get assigned to next year. Hence my struggle!
Thank you so much for you help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.