Forums

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

Scheduled automation of a JQL is failing

Ofir Oxenberg June 29, 2025

Hello, 

 

I'm trying to create an automation that will check the number of weeks between 2 date fields. 

It is a scheduled automation with a JQL (For the testing I'm looking for specific test tickets) 

Screenshot 2025-06-29 at 19.01.50.png

Then I'm trying to check the amount of time between my 2 custom fields with: 
{{issue.customfield_10751.diff(issue.customfield_10750).days.divide(7)}}

Screenshot 2025-06-29 at 19.02.42.png

And according to the number of weeks, I want to set a certain field. 

The automation is failing. 

When trying to debug and print in a log the values of {{issue.customfield_10750}} for example, it returns nothing, an empty log. 

 

Will appreciate the help, Thanks! 

4 answers

3 accepted

6 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.
June 29, 2025

Hi @Ofir Oxenberg 

If you write both of those date fields to the log before the condition, what do you observe in the values?

 

Have you tried using the weeks unit of measure for the diff() rather than using days and dividing by 7: 

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-difference---

And, some other things about your expression:

  • The result of the diff() function is an integer, and so when you divide that value, integer division is used.  Thus the round is not needed, and the results could be different than you expect.  (The exception is when prettyPrint format is used.)
  • The inline version of the round function does not take parameters, and so that may be causing problems.  As noted above, the function is not needed if you just use weeks for the units.

 

Kind regards,
Bill

1 vote
Answer accepted
arielei
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.
June 29, 2025

Hey @Ofir Oxenberg 

try adding "jiraDate()" like this:

{{issue.customfield_10750.jiraDate()}}

 

either way, check the {} smart values for your options on how to get the value of the date. 

 

0 votes
Answer accepted
Ofir Oxenberg June 30, 2025

Back again, 

Now, when I change the query to 
{{issue.customfield_10751.diff(issue.customfield_10750).weeks}}

I get a round number, and I'm trying to get the decimal number. 
For example, if the number of days between 2 dates is 34, then the gap is 4.8 weeks, and i get 4 from the query.

What do i need to change to get the decimal number? 

Thanks! 

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.
June 30, 2025

Hi @Ofir Oxenberg 

Noting my post earlier about integer-division for the inline math expression...

When you want the decimal value for this case, switch back to the days units and use the long-format math expression:

{{#=}}{{issue.customfield_10751.diff(issue.customfield_10750).days}} / 7{{/}}

And if you want to manage the precision, add the longer format ROUND() function.  For example, to have 2 digits try this:

{{#=}}ROUND( {{issue.customfield_10751.diff(issue.customfield_10750).days}} / 7, 2 ){{/}}

 

Ofir Oxenberg June 30, 2025

Thank you!! 

i changed it to what you said and added the ABS(), and it works.


{{#=}}ROUND(ABS({{issue.customfield_10751.diff(issue.customfield_10750).days}} / 7), 2){{/}}

Like Bill Sheboy likes this
0 votes
Ofir Oxenberg June 30, 2025

Thank you both, i changed it to 

{{issue.customfield_10751.diff(issue.customfield_10750).weeks}}

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events