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)
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)}}
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!
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:
And, some other things about your expression:
Kind regards,
Bill
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 ){{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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){{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you both, i changed it to
{{issue.customfield_10751.diff(issue.customfield_10750).weeks}}
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.