How to calculate the number of days a ticket is over the due date?

Breonna Bowen April 27, 2020

Screen Shot 2020-04-27 at 9.13.40 AM.png

We are currently trying to capture the number of days a ticket is overdue, based on the difference between the due date and now. 

I keep getting the following error message: 

Could not convert the field value to a number. Please ensure the value is a number, math expression or smart-value that can be converted into a number. Total Time Overdue in Days: {now.diff(issue.duedate).days}}

Can someone tell what smart value I should be entering to make this work? 

 

2 answers

2 accepted

2 votes
Answer accepted
Mohamed Benziane
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 27, 2020

Hello @Breonna Bowen 

Welcome to the community.

Not an automation expert, but can you try this:

{{now.diff(issue.dueDate).days}} instead of {now.diff(issue.duedate).days}}

https://support.atlassian.com/jira-software-cloud/docs/use-smart-values-to-manipulate-and-format-dates/#calculating-the-difference-between-two-dates 

automation.png

Breonna Bowen April 27, 2020

Ah! Thank you! 

Like vadimvinogradov likes this
1 vote
Answer accepted
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 27, 2020

Hi Breonna - Welcome to the Atlassian Community!

You are missing a { at the very beginning of the Smart Value. It should have two {{

Breonna Bowen April 27, 2020

That worked, thanks! 

Zaldy Parian
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.
December 3, 2020

Hi @John Funk 

I tried this: {{now.diff(issue.created).days}} on my automation. But it returned an error of:

Error while parsing additional fields. Not valid JSON.
Any idea why?

We're using Jira Cloud. And I'm trying to update a custom field when the status is changed.

 

Regards,
Zaldy

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 4, 2020

Hi Zaldy - can you share the rule that you have? 

Zaldy Parian
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.
December 5, 2020

Hi @John Funk ,

I think I got it now.

daysopen.jpgAnd I have to move now() after issue.date to get a positive number.

Thanks for your help.

Like John Funk likes this

Suggest an answer

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

Atlassian Community Events