Heads up! On March 5, starting at 4:30 PM Central Time, our community will be undergoing scheduled maintenance for a few hours. During this time, you will find the site temporarily inaccessible. Thanks for your patience. Read more.

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

How to write jql condition for Created date is within 5 business days of end of month

Neha Shah
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!
October 8, 2021

Hi - Can someone help me with how I can create a automation condition for when the ticket created date is within 5 business days of the end of a month. 

My purpose is to add actions based on the fact that a certain issue type ticket was created within last 5 business days of any month and move it to a higher priority, add labels, etc. 

Also would advanced compare condition or compare condition be the better route. 

Thank you for your help in advance! 

1 answer

1 accepted

2 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.
October 8, 2021

Hi @Neha Shah  -- Welcome to the Atlassian Community!

What have you tried so far, as the functions you ask about are described here: https://support.atlassian.com/jira-software-cloud/docs/smart-values-date-and-time-functions/

To compare something like this, you probably want to use an advanced compare condition.  That will give you better control over what is being checked.  For example:

  • first value: {{issue.created.diff(now.lastBusinessDayOfMonth).businessDays}}
  • condition: less than or equal to
  • second value: 5

If you review that documentation page, you can adjust what I show to match your need for comparing to any month (such as during the same month as the create date).

For your Jira instance, you would want to check on your settings for working days/time, and then test as the behavior of the date/time smart value functions is impacted by those settings.

Kind regards,
Bill

Neha Shah
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!
October 8, 2021

Hi @Bill Sheboy

Thanks so much for getting back to me on this. I used the below advanced compared condition but I don't have the less than or equal to (see image). It does work but i'm unsure if it's pulling for last month vs current month. image.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.
October 8, 2021

Sorry I missed that!  I guess I always assumed the condition had all the logical operators.  Using less than and 6 is a good work-around.

And...the expression you show seems to be asking: 

  • From {{now}}, how many days in the past was this created, and then give me the last business day of that month.  I do not believe that is what you asked, correct? 
  • Please note that diff() works going left-to-right, so the first date value is subtracted from the second.

Which of these do you want to check:

  1. # business days between created and end of *the current month*
  2. # business days between created and end of *the month the issue was created*

The expression for #1 would be: 

{{issue.created.diff(now.lastBusinessDayOfMonth).businessDays}}

The expression for #2 would be:

{{issue.created.diff(issue.created.lastBusinessDayOfMonth).businessDays}}

Suggest an answer

Log in or Sign up to answer