Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hi all, I'm currently trying to use an automated process whereby when a user moves a task from "In Progress" to either "To Do" or "Done", their time is automatically logged in the Time Tracking property.
I'm trying to use this but it always returns 0:
{{issue.statuscategorychangedate.toDate.diff(now).minutes}}
Thanks
Hi @Alex Burns
Welcome to the community, you can follow these steps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alex Burns with toDate you need to specify the date format.
{{issue.statuscategorychangedate.toDate("yyyy-MM-dd").diff(now).minutes}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The toDate function only needs the help of a specific format expression when the date or date / time is in an ambiguous or non-standard format: https://support.atlassian.com/cloud-automation/docs/examples-of-using-smart-values-with-dates/#Converting-text-to-dates
Otherwise, it will will succeed with standard formats such as jiraDate, jiraDateTime, etc.
The root cause of the original poster's error was using statusCategoryChangedDate after it had already changed value rather than when the category last changed.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy
Thanks for pointing out the .toDate part. My bad that I didn't test this myself before putting on the forum.
For your second point (root cause), I am not clear. Could you please elaborate?
My understanding
When issue is transitioned from say "In Progress" to "To Do", then statuscategorychangedate will give the time when issue status changed to "To Do". is my understanding correct?
However, I do understand that as soon as transition happens automation rule will trigger and in 99.99% cases statuscategorychangedate and now will have same value and hence this calculation with will most likely return 0?
So, would using the approach that Pasam mentioned in steps 1 & 2 would give the time when issue came in status "In Progress"?
Regards,
Vishal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, and...
First thing: I would not recommend automatically tracking / logging time this way. It assumes two things that may not be valid: people correctly transition issues as-soon-as work starts / stops, and logging calendar / clock time is what is desired (rather than actual working time).
And, you are correct the statusCategoryChangedDate contains when the most recent status category changed. When one wants to implement what the original poster requested, they would use a more sophisticated rule, with multiple custom fields: the previous status category and the previous status category changed date / time. However this is implemented, the rule will get complicated quickly with the number of conditions / scenarios required. One possible approach could be:
One would need to decide which cases to cover, including how to handle people incorrectly transitioning issues. For example:
New Status Category
Old Status Category To Do In Progress Done
------------------- ----- ----------- -------
To Do X start clock measure
In Progress measure X measure
Done valid? valid? X
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alex,
Could you provide a specific example of what you need when a user changes the issue status from "In Progress" to any other status?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register Now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.