Issue:
We are trying to use Jira Automation to calculate the duration between two custom Date Time fields ("Actual Start" and "Actual End") on an issue and populate that duration (in minutes) into a custom Number Field ("INC resolution time"). However, the smart values required for this calculation (.toDate()
and diff
) are not working as expected.
Automation Rule Setup:
Fields Involved:
customfield_10524
)customfield_10525
)Problem Observed:
Initially, the "INC resolution time" field was not updating even with a static value (e.g., 999
). This was found to be a permissions/workflow issue, which has since been resolved, and the field can now be updated by the rule with a static value.
However, when attempting to use smart values to calculate the duration, the field does not update, and debugging reveals the smart value calculation is failing.
Troubleshooting Steps Taken & Findings:
{{issue.customfield_10525.toDate.diff(issue.customfield_10524.toDate).minutes}}}
to calculate the duration in minutes..toDate()
, the diff
object, and the calculated minutes.INCIDENT-1145
) with valid "Actual Start" and "Actual End" dates/times.2025-04-29T16:15:00.0+0000
, 2025-05-06T13:40:00.0+0000
).{{issue.customfield_10524.toDate}}
and {{issue.customfield_10525.toDate}}
are evaluating to empty strings or null ("ToDate Start:" and "ToDate End:" are blank in the log).{{issue.customfield_10525.toDate.diff(issue.customfield_10524.toDate)}}
is also evaluating to an empty object ("Difference object:" is blank), and {{...minutes}}
is also blank.{{issue.customfield_10525}} - {{issue.customfield_10524}}
in the "Edit issue" action resulted in an error "Could not convert the field value to a number...", confirming that date fields are not treated as numbers for arithmetic.Conclusion from Troubleshooting:
The root cause of the issue is that the standard Jira Automation smart value function .toDate()
is failing to convert the raw values from our specific custom Date Time fields ("Actual Start" and "Actual End") into usable date objects. Because .toDate()
is failing, the subsequent diff
smart value cannot perform the duration calculation. Standard smart values do not offer an alternative method to convert these field values to date objects or perform date arithmetic.
Request:
Could you please investigate why the .toDate()
smart value is not working as expected with our custom Date Time fields (IDs customfield_10524
and customfield_10525
) and provide guidance on how to correctly convert these field values to date objects and calculate the duration between them using Jira Automation?
Thank you for your assistance.
Hi @Nathan T_ Gundy -- Welcome to the Atlassian Community!
The toDate() function converts a text value to a date / time: https://support.atlassian.com/cloud-automation/docs/examples-of-using-smart-values-with-dates/#Converting-text-to-dates
Your custom fields are already date (or date / time) picker fields, and so the conversion function is not needed. Please try removing the functions and re-testing.
There are exceptions to this guidance, but they do not appear to apply for your rule:
Kind regards,
Bill
Hi @Nathan T_ Gundy and Welcome to the Atlassian Community!
can you try this smart value;
{{issue.customfield_10525.diff(issue.customfield_10524).minutes}}
If the answer helps, please accept the answer.
Best regards,
Murat Seven
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.