Forums

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

Update number field with result of difference between 2 date custom fields

Yi Meng
Contributor
February 26, 2025

Hi Community,

I'm trying to compare 2 date fields, target start and target end. Both are created for advanced roadmap. And I want to calculate the difference between these 2 fields and put the result in a number field -- I created one called 'Cycle time'. 

I tried to use the smart value to achieve this. So, I make the formula like this:

"

{{issue.customfield_10023.diff(issue.customfield_10022).days}}

"

But the it just gives me result as null. 

I tried to use {{now.diff(issue.created)}} to update the same numeric field. It works fine. Is it because the target start and target end is not a common date time field? Any suggestions? Thank you. 

 

Yi

1 answer

1 accepted

1 vote
Answer accepted
Trudy Claspill
Community Champion
February 26, 2025

Hello @Yi Meng 

It sounds like you might be working with an Automation Rule.

So that we can help you properly debug that rule please provide us screen images showing the entire automation rule, the details of each step, and all the details from the audit log for execution of that rule.

You may also want to incorporate Log action steps into your rule to print out values into the rule execution audit log to confirm the smart values are getting the values you expect. For instance you may want to print out these values right before you try to do the calculation.:

{{issue.customfield_10023}}

{{issue.customfield_10022}}

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.
February 26, 2025

Hi @Yi Meng 

Adding to Trudy's suggestions...

I believe those advanced planning fields are recognized as text and not date type inside of automation rules.  Please try adding the toDate conversion.  For example:

{{issue.customfield_10023.toDate.diff(issue.customfield_10022.toDate).days}}

 

Kind regards,
Bill

Like # people like this
Yi Meng
Contributor
February 27, 2025

Hi @Bill Sheboy 

You're right, I added toDate conversion in my formula and it works fine. Thanks a lot!

 

Like Bill Sheboy likes this

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