Calculate the time spent on each status and total time on a work item in Jira Cloud
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
Learn how to create an automation that provides a way to calculate the time in status for any issue.
Solution
This automation rule example is designed to operate according to the following workflow.

According to this workflow, the issue can be resolved at any support level or escalated to the next support level.
In either case, the total time spent in the previous status will be calculated and stored in the system field belonging to that level.
Since the issue can be reopened and returned to support level one, the automation rule is designed to sum the previous time with the current time, showing the total time spent in the status over multiple iterations.
Prerequisites
Before you build the automation rule, create the following custom fields in your project. All time-taken fields must be Number type; the date fields must be DateTime type.
Field name | Field type | Purpose |
Start date cf | Date Time | Records when the work item enters a status |
End date cf | Date Time | Records when the work item leaves a status |
Time Taken at Level 1 Support | Number | Stores cumulative minutes spent in Level 1 Support |
Time Taken at Level 2 Support | Number | Stores cumulative minutes spent in Level 2 Support |
Time Taken at Level 3 Support | Number | Stores cumulative minutes spent in Level 3 Support |
Time Taken at User Testing | Number | Stores cumulative minutes spent in User Testing |
Total Time Taken by All Support Levels | Number | Stores the sum of time across all statuses |
Tip: Add every field above to the relevant issue screens so the automation can read and write them. Fields that aren't on a screen will silently fail to update.
The following expression records the entry and exit in the Australian time zone for any given status.
{{now.convertToTimeZone("Australia/Sydney")}}This automation rule calculates two kinds of totals: the time spent in each status and the total time spent on the issue from start to finish. The following expression calculates the time in each status and the total time spent on the issue.

{{#=}}{{issue.Time Taken at User Testing}} + {{issue.End date cf.diff(issue.start date cf).abs.minutes}}{{/}}
{{#=}}{{issue.Total Time Taken by All Support Levels}} + {{issue.End date cf.diff(issue.Start date cf).abs.minutes}}{{/}}The time difference is calculated using the status entry time and status exit time. To find the status that the issue was transitioned from, the following smart expression is used
{{#changelog.status}}{{from}}{{/}}
The status ID can be found by navigating to the global status page, https://your-site.atlassian.net/secure/admin/ViewStatuses.jspa. Hover over the 'Edit' link next to each status line and note the status ID from the URL that appears at the bottom of the page.
Currently, the automation rule calculates the time in minutes but you can change it to units as mentioned in Calculating time difference.
Copy the JSON below into a file (e.g. automation-rule.json) and import the rule to your site.
{"cloud":true,"rules":[{"id":6804207,"clientKey":"fd13fe83-0060-3148-9e44-0578305ad3c1","name":"Workflow-status-time-calculator using ChangeLog","state":"ENABLED","description":null,"authorAccountId":"557058:febb5479-9025-48a7-ac00-1e6f2c53d979","actor":{"type":"ACCOUNT_ID","value":"557058:f58131cb-b67d-43c7-b30d-6b58d40bd077"},"created":1656489355760,"updated":1656521586675,"trigger":{"id":"129212603","component":"TRIGGER","parentId":null,"conditionParentId":null,"schemaVersion":1,"type":"jira.issue.event.trigger:transitioned","value":{"eventKey":"jira:issue_updated","issueEvent":"issue_generic","fromStatus":[],"toStatus":[]},"children":[],"conditions":[],"connectionId":null},"components":[{"id":"129212604","component":"CONDITION","parentId":null,"conditionParentId":null,"schemaVersion":1,"type":"jira.condition.container.block","value":null,"children":[{"id":"129212605","component":"CONDITION_BLOCK","parentId":"129212604","conditionParentId":null,"schemaVersion":1,"type":"jira.condition.if.block","value":{"conditionMatchType":"ALL"},"children":[{"id":"129212608","component":"ACTION","parentId":"129212605","conditionParentId":null,"schemaVersion":10,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"start date cf"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:datetime","type":"SET","value":"{{now.convertToTimeZone(\"Australia/Sydney\")}}"}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null}],"conditions":[{"id":"129212606","component":"CONDITION","parentId":null,"conditionParentId":"129212605","schemaVersion":3,"type":"jira.issue.condition","value":{"selectedField":{"type":"ID","value":"status"},"selectedFieldType":"status","comparison":"EQUALS","compareValue":{"type":"NAME","modifier":null,"value":"Level 1 Support","multiValue":false,"source":null}},"children":[],"conditions":[],"connectionId":null},{"id":"129212607","component":"CONDITION","parentId":null,"conditionParentId":"129212605","schemaVersion":1,"type":"jira.comparator.condition","value":{"first":"{{#changelog.status}}{{from}}{{/}}","second":"10104","operator":"EQUALS"},"children":[],"conditions":[],"connectionId":null}],"connectionId":null},{"id":"129212609","component":"CONDITION_BLOCK","parentId":"129212604","conditionParentId":null,"schemaVersion":1,"type":"jira.condition.if.block","value":{"conditionMatchType":"ALL"},"children":[{"id":"129212612","component":"ACTION","parentId":"129212609","conditionParentId":null,"schemaVersion":10,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"End Date cf"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:datetime","type":"SET","value":"{{now.convertToTimeZone(\"Australia/Sydney\")}}"}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null},{"id":"129212613","component":"ACTION","parentId":"129212609","conditionParentId":null,"schemaVersion":1,"type":"jira.issue.refresh.issue","value":{"delayMs":null},"children":[],"conditions":[],"connectionId":null},{"id":"129212614","component":"ACTION","parentId":"129212609","conditionParentId":null,"schemaVersion":10,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"Time Taken at User Testing"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:float","type":"SET","value":"{{#=}}{{issue.Time Taken at User Testing}} + {{issue.End date cf.diff(issue.start date cf).abs.minutes}}{{/}}"},{"field":{"type":"NAME","value":"Total Time Taken by All Support Levels"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:float","type":"SET","value":"{{#=}}{{issue.Total Time Taken by All Support Levels}} + {{issue.End date cf.diff(issue.Start date cf).abs.minutes}}{{/}}"}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null},{"id":"129212615","component":"ACTION","parentId":"129212609","conditionParentId":null,"schemaVersion":10,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"start date cf"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:datetime","type":"SET","value":"{{now.convertToTimeZone(\"Australia/Sydney\")}}"}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null}],"conditions":[{"id":"129212610","component":"CONDITION","parentId":null,"conditionParentId":"129212609","schemaVersion":3,"type":"jira.issue.condition","value":{"selectedField":{"type":"ID","value":"status"},"selectedFieldType":"status","comparison":"EQUALS","compareValue":{"type":"NAME","modifier":null,"value":"LEVEL 1 SUPPORT","multiValue":false,"source":null}},"children":[],"conditions":[],"connectionId":null},{"id":"129212611","component":"CONDITION","parentId":null,"conditionParentId":"129212609","schemaVersion":1,"type":"jira.comparator.condition","value":{"first":"{{#changelog.status}}{{from}}{{/}}","second":"10216","operator":"EQUALS"},"children":[],"conditions":[],"connectionId":null}],"connectionId":null},{"id":"129212616","component":"CONDITION_BLOCK","parentId":"129212604","conditionParentId":null,"schemaVersion":1,"type":"jira.condition.if.block","value":{"conditionMatchType":"ALL"},"children":[{"id":"129212619","component":"ACTION","parentId":"129212616","conditionParentId":null,"schemaVersion":10,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"End Date cf"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:datetime","type":"SET","value":"{{now.convertToTimeZone(\"Australia/Sydney\")}}"}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null},{"id":"129212620","component":"ACTION","parentId":"129212616","conditionParentId":null,"schemaVersion":1,"type":"jira.issue.refresh.issue","value":{"delayMs":null},"children":[],"conditions":[],"connectionId":null},{"id":"129212621","component":"ACTION","parentId":"129212616","conditionParentId":null,"schemaVersion":10,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"Time Taken at Level 1 Support"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:float","type":"SET","value":"{{#=}}{{issue.Time Taken at Level 1 Support}} + {{issue.End date cf.diff(issue.start date cf).abs.minutes}}{{/}}"},{"field":{"type":"NAME","value":"Total Time Taken by All Support Levels"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:float","type":"SET","value":"{{#=}}{{issue.Total Time Taken by All Support Levels}} + {{issue.End date cf.diff(issue.Start date cf).abs.minutes}}{{/}}"}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null},{"id":"129212622","component":"ACTION","parentId":"129212616","conditionParentId":null,"schemaVersion":10,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"start date cf"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:datetime","type":"SET","value":"{{now.convertToTimeZone(\"Australia/Sydney\")}}"}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null}],"conditions":[{"id":"129212617","component":"CONDITION","parentId":null,"conditionParentId":"129212616","schemaVersion":3,"type":"jira.issue.condition","value":{"selectedField":{"type":"ID","value":"status"},"selectedFieldType":"status","comparison":"ONE_OF","compareValue":{"type":"NAME","modifier":null,"value":"[\"LEVEL 2 SUPPORT\",\"Resolved\"]","multiValue":true,"source":null}},"children":[],"conditions":[],"connectionId":null},{"id":"129212618","component":"CONDITION","parentId":null,"conditionParentId":"129212616","schemaVersion":1,"type":"jira.comparator.condition","value":{"first":"{{#changelog.status}}{{from}}{{/}}","second":"10209","operator":"EQUALS"},"children":[],"conditions":[],"connectionId":null}],"connectionId":null},{"id":"129212623","component":"CONDITION_BLOCK","parentId":"129212604","conditionParentId":null,"schemaVersion":1,"type":"jira.condition.if.block","value":{"conditionMatchType":"ALL"},"children":[{"id":"129212626","component":"ACTION","parentId":"129212623","conditionParentId":null,"schemaVersion":10,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"End Date cf"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:datetime","type":"SET","value":"{{now.convertToTimeZone(\"Australia/Sydney\")}}"}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null},{"id":"129212627","component":"ACTION","parentId":"129212623","conditionParentId":null,"schemaVersion":1,"type":"jira.issue.refresh.issue","value":{"delayMs":null},"children":[],"conditions":[],"connectionId":null},{"id":"129212628","component":"ACTION","parentId":"129212623","conditionParentId":null,"schemaVersion":10,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"Time Taken at Level 2 Support"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:float","type":"SET","value":"{{#=}}{{issue.Time Taken at Level 2 Support}} + {{issue.End date cf.diff(issue.start date cf).abs.minutes}}{{/}}"},{"field":{"type":"NAME","value":"Total Time Taken by All Support Levels"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:float","type":"SET","value":"{{#=}}{{issue.Total Time Taken by All Support Levels}} + {{issue.End date cf.diff(issue.Start date cf).abs.minutes}}{{/}}"}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null},{"id":"129212629","component":"ACTION","parentId":"129212623","conditionParentId":null,"schemaVersion":10,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"start date cf"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:datetime","type":"SET","value":"{{now.convertToTimeZone(\"Australia/Sydney\")}}"}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null}],"conditions":[{"id":"129212624","component":"CONDITION","parentId":null,"conditionParentId":"129212623","schemaVersion":3,"type":"jira.issue.condition","value":{"selectedField":{"type":"ID","value":"status"},"selectedFieldType":"status","comparison":"ONE_OF","compareValue":{"type":"NAME","modifier":null,"value":"[\"LEVEL 3 SUPPORT\",\"Resolved\"]","multiValue":true,"source":null}},"children":[],"conditions":[],"connectionId":null},{"id":"129212625","component":"CONDITION","parentId":null,"conditionParentId":"129212623","schemaVersion":1,"type":"jira.comparator.condition","value":{"first":"{{#changelog.status}}{{from}}{{/}}","second":"10211","operator":"EQUALS"},"children":[],"conditions":[],"connectionId":null}],"connectionId":null},{"id":"129212630","component":"CONDITION_BLOCK","parentId":"129212604","conditionParentId":null,"schemaVersion":1,"type":"jira.condition.if.block","value":{"conditionMatchType":"ALL"},"children":[{"id":"129212633","component":"ACTION","parentId":"129212630","conditionParentId":null,"schemaVersion":10,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"End Date cf"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:datetime","type":"SET","value":"{{now.convertToTimeZone(\"Australia/Sydney\")}}"}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null},{"id":"129212634","component":"ACTION","parentId":"129212630","conditionParentId":null,"schemaVersion":1,"type":"jira.issue.refresh.issue","value":{"delayMs":null},"children":[],"conditions":[],"connectionId":null},{"id":"129212635","component":"ACTION","parentId":"129212630","conditionParentId":null,"schemaVersion":10,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"Time Taken at Level 3 Support"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:float","type":"SET","value":"{{#=}}{{issue.Time Taken at Level 3 Support}} + {{issue.End date cf.diff(issue.start date cf).abs.minutes}}{{/}}"},{"field":{"type":"NAME","value":"Total Time Taken by All Support Levels"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:float","type":"SET","value":"{{#=}}{{issue.Total Time Taken by All Support Levels}} + {{issue.End date cf.diff(issue.Start date cf).abs.minutes}}{{/}}"}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null},{"id":"129212636","component":"ACTION","parentId":"129212630","conditionParentId":null,"schemaVersion":10,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"start date cf"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:datetime","type":"SET","value":"{{now.convertToTimeZone(\"Australia/Sydney\")}}"}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null}],"conditions":[{"id":"129212631","component":"CONDITION","parentId":null,"conditionParentId":"129212630","schemaVersion":3,"type":"jira.issue.condition","value":{"selectedField":{"type":"ID","value":"status"},"selectedFieldType":"status","comparison":"EQUALS","compareValue":{"type":"NAME","modifier":null,"value":"Resolved","multiValue":false,"source":null}},"children":[],"conditions":[],"connectionId":null},{"id":"129212632","component":"CONDITION","parentId":null,"conditionParentId":"129212630","schemaVersion":1,"type":"jira.comparator.condition","value":{"first":"{{#changelog.status}}{{from}}{{/}}","second":"10213","operator":"EQUALS"},"children":[],"conditions":[],"connectionId":null}],"connectionId":null},{"id":"129212637","component":"CONDITION_BLOCK","parentId":"129212604","conditionParentId":null,"schemaVersion":1,"type":"jira.condition.if.block","value":{"conditionMatchType":"ALL"},"children":[{"id":"129212640","component":"ACTION","parentId":"129212637","conditionParentId":null,"schemaVersion":10,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"End Date cf"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:datetime","type":"SET","value":"{{now.convertToTimeZone(\"Australia/Sydney\")}}"}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null},{"id":"129212641","component":"ACTION","parentId":"129212637","conditionParentId":null,"schemaVersion":1,"type":"jira.issue.refresh.issue","value":{"delayMs":null},"children":[],"conditions":[],"connectionId":null},{"id":"129212642","component":"ACTION","parentId":"129212637","conditionParentId":null,"schemaVersion":10,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"Time Taken at User Testing"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:float","type":"SET","value":"{{#=}}{{issue.Time Taken at User Testing}} + {{issue.End date cf.diff(issue.start date cf).abs.minutes}}{{/}}"},{"field":{"type":"NAME","value":"Total Time Taken by All Support Levels"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:float","type":"SET","value":"{{#=}}{{issue.Total Time Taken by All Support Levels}} + {{issue.End date cf.diff(issue.Start date cf).abs.minutes}}{{/}}"}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null}],"conditions":[{"id":"129212638","component":"CONDITION","parentId":null,"conditionParentId":"129212637","schemaVersion":3,"type":"jira.issue.condition","value":{"selectedField":{"type":"ID","value":"status"},"selectedFieldType":"status","comparison":"EQUALS","compareValue":{"type":"NAME","modifier":null,"value":"Closed","multiValue":false,"source":null}},"children":[],"conditions":[],"connectionId":null},{"id":"129212639","component":"CONDITION","parentId":null,"conditionParentId":"129212637","schemaVersion":1,"type":"jira.comparator.condition","value":{"first":"{{#changelog.status}}{{from}}{{/}}","second":"10216","operator":"EQUALS"},"children":[],"conditions":[],"connectionId":null}],"connectionId":null}],"conditions":[],"connectionId":null}],"canOtherRuleTrigger":false,"notifyOnError":"FIRSTERROR","projects":[{"projectId":"10006","projectTypeKey":"service_desk"}],"labels":[],"tags":[],"ruleScope":{"resources":["ari:cloud:jira:59b8197a-2cf9-4518-a22e-2693f08776fa:project/10006"]},"writeAccessType":"UNRESTRICTED","collaborators":[]}]}How to confirm the timings populate
After you import and enable the rule, verify it works end-to-end:
Create a test work item in the project where the rule is scoped.
Transition the work item through each status in your workflow. Wait at least one minute in each status so the time difference is visible.
Open the work item and check the time-taken fields. Each status-level field should show the number of minutes the work item spent in that status.
Check the Total Time field. Total Time Taken by All Support Levels should equal the sum of all individual status fields.
Test a re-open scenario. Transition the work item back to Level 1 Support, wait, then move it forward again. Confirm the rule adds the new time to the existing value rather than replacing it — this validates the summing-across-iterations logic.
If a field shows 0 or is blank:
Confirm the field is on the work item's screen (fields not on the screen won't update).
Open the automation rule's Audit log and check for errors on the relevant execution.
Verify the status IDs in the rule's conditions match your project's workflow. You can find status IDs at Settings > Issues > Statuses (or by hovering the Edit link on the global statuses page and noting the ID in the URL).
Was this helpful?