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 might 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

JQL - Date custom field is after 2 days from now, or later than 2 days after createdDate

mateus_oliveira May 22, 2024

I'm trying to build an automation to cancel any issue created with a due date shorter than 48h.

However, we use a custom field to determine the due date of our issues.

I did some research, but I wasn't able to find anything that helps with my case... Most of any date operations I found are not accepted on Advanced Search, and therefore I can't really test the Automation JQL, since the syntax is not always the same and I wouldn't have any idea of what I may be doing wrong.

Ideally, it would compare the CF Due Date with the Creation Date +2 days... comparing the CF Due Date with now(+2d) would be just fine, but it seems this is not acceptable.

(p.s.: I can't install any type of extensions/plugins - like ScriptRunner, I'm the project admin but not admin for the Jira instance, so any setting or installation to the project is most probably out of my reach)

1 answer

1 accepted

1 vote
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.
May 22, 2024

Hi @mateus_oliveira 

I do not believe that comparison is possible with the built-in features of JQL.

However if your rule used other criteria to find the issues first, rule conditions could be used.  For example:

You may want another rule, triggered on a change to the due date field, in the event someone sets the due date after issue creation.

Kind regards,
Bill

mateus_oliveira May 22, 2024

I'm sorry but I'm not sure I follow...

Should I use an Advanced Compare and use

{{issue.cf_[22222]}} [less than] {{now.plusDays(2)}}

Or maybe

{{issue.cf_[22222].diff(now.plusDays(2).days}} [less than] 2 ...

Since I can't validate Smart Values, it's difficult to decide what's the best way to proceed....

Thank you for taking your time and trying to help!

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.
May 22, 2024

For the first one, they will not necessarily compare correctly unless put into a known format.  For example you could also compare:

{{issue.cf_[22222].jiraDate}} less than {{now.plusDays(2).jiraDate}}

That would but both in the format "YYYY-MM-dd", allowing the less than to work as expected.

 

I recommend using the second one with the diff() function, and writing the smart values to the audit to confirm what they contain.

 

mateus_oliveira May 23, 2024

Thanks, Bill! I used an IF with Advanced Compare Condition, filled with

` {{issue.cf_[22222].diff(now.plusDays(2).days)}} [less than] 2 `

and it worked like a charm. Once again, thanks for your will to help!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer