This template displays the number of times that the status was changed in the current work item.
Configuration
To use the Count status changes template, simply select it from the template grid. Filter by Status to find it faster.
Parameters
This template does not require any additional parameter configuration.
Expert mode
If you switch to Expert mode you can see the formula field in the Expression Parser. You can now tweak the expression to create a custom formula field based on this template.
Expression
Jira expression:
issue.changelogs.filter(changelog => changelog.items.some(item => item.fieldId == 'status')).length
Display as
Number
Formatting style
Default (unformatted)
Details
1. What does the expression do?
This expression counts how many times the status of the current work item has changed. In other words, it tells you the total number of status transitions that have occurred for the current work item.
2. Step-by-step breakdown
Let’s break it down:
-
issue.changelogs: This refers to the complete history of changes (changelogs) for the current work item. -
.filter(...): This narrows down the changelogs to only those entries that meet a certain condition. -
changelog => changelog.items.some(...): For each changelog entry, this checks if any of the changes within that entry are related to the "status" field. -
item => item.fieldId == 'status': This looks at each individual change (item) within a changelog entry and checks if the field that was changed is the status. -
.length: After filtering, this counts the number of changelog entries where the status was changed.
3. Examples
Suppose a work item has the following change history:
-
First, the summary was updated (not a status change).
-
Then, the status changed from "To Do" to "In Progress".
-
Later, the assignee was changed (not a status change).
-
Then, the status changed from "In Progress" to "Done".
The expression would count only the two changelogs where the status changed, so the result would be 2.
4. Real-life use cases
-
Tracking workflow progress: You can use this expression to see how many times a work item has moved between different statuses, which can help identify items that are being moved back and forth or are stuck in review.
-
Process improvement: If you notice that certain types of work items have a high number of status changes, it might indicate confusion or inefficiency in your workflow.
-
Reporting: This count can be displayed in dashboards or reports to give stakeholders insight into how work items are progressing through your process.