Guest Authors - Nicolas Brown & Caidyrn Roder | Workflow Optimizers & ProKanban.org Community Contributors
Note: This is Part 1 of our two-part series on automating flow metrics in Jira. In this post, we'll dive deep into work item age and how to track it effectively. Once you've mastered this foundational metric, be sure to read Part 2, where we explore cycle time automation and how these metrics work together to give you complete visibility into your team's flow.
Work item age is one of the most useful metrics to monitor to help your teams improve their predictability. The Kanban guide defines work item age as the elapsed time between when a work item started and the current date.
As teams start to take more interest in how their work flows, one of the biggest enablers is making that information easy to access. Flow metrics like Work Item Age are a massive help for teams, but more often than not are in a separate tool or URL, which makes it too easy to ignore. And unless it’s right in front of them, it’s rarely part of the conversation.
Jira tries to help somewhat with this, with the ‘Days In Column’ view that can be added to a work item, but this only gets us so far and often can be damaging in that it masks work items that aren’t ‘flowing’. Thankfully, we can leverage Jira’s automation functionality, along with some custom fields to make Work Item Age front and centre for every team…
A brief warning on automation rule limits before we get started. The number of automation rules that you can run each month depends on your Jira plan. Both of the approaches that we present in this article will increase the number of automation rule runs for your instance, so we recommend checking your current limits and usage before jumping in.
One of the assumptions with the most basic way to configure this is that you have correctly configured your statuses in the right status category within Jira, which is explained here. Similarly, you will also need to be able to (or have access to someone else who can) create custom fields on work items.
Assuming you have this setup, the first thing we need to do is create a custom field for Work Item Age. To do this, go to your jira admin page, which will be at (for Jira Cloud):
https://[YourJiraInstance].atlassian.net/jira/settings/issues/fields?query=&orderBy=name&page=0
Here you want to click on ‘Create new field’:
Here you want to choose a field type of ‘Number’ then give your Work Item Age field a name and (optional) description, then click ‘Create’:
Next, in your kanban board you want to click on the automation button, then Create automation:
We first want to establish the ‘trigger’ for the automation, which should be running it on a daily basis (which is under ‘Scheduled’):
Firstly we want to set up the schedule which is daily and, more often than not, just before we start work for the day, so then the work item age is updated ahead of our stand-up. Of course, make sure the timezone matches yours!
Scroll down a bit further, and tick the box to Run a JQL search and execute actions for each work item in the query then add the following:
statuscategory = “In Progress”
If you click ‘Validate query’ it should bring back a number of work items (all those that are in progress) that match that criteria:
Here you can obviously add more complexity to the JQL, for example you might only want to update Work Item Age for Stories, not Epics. For the purpose of brevity we’ve kept this simple and just looked at everything that is ‘In Progress’.
Click ‘Next’ then you want to choose THEN: add an action
You want to scroll down till you find ‘Edit work item’
Then we need to search for our Work Item Age field, and select it:
Then, with the empty field we want to enter the following:
{{#=}}CEILING({{issue.statuscategorychangedate.toDate.diff(now).minutes}}/1440){{/}}
This is going to calculate the date difference between the current date and when the work item first entered the “In Progress” status category, i.e. when it was ‘started’. It will also +1 so that we’re never with items having 0 days as their Work Item Age value.
Then all we need to do is give our automation a name, and ensure it is enabled:
What you might want to do is rather than wait till the next day to run it, you can run it now. Choose the ellipsis then click ‘Run rule’
You’ll then see Work Item Age appear on the work item form, like so:
We can then take this further, making the Work Item Age field a visible field in our Kanban Board view:
Then Work Item Age can be front and centre when using boards in our standups/huddles:
Of course, you could take this even further by ordering your board by work item age by modifying the underlying JQL you are using for your kanban board to be populated from.
Either way now we have made this information highly visible to everyone in the team, without the need to navigate away from the ‘work’ to find out information on the biggest influencing flow metric of them all.
While the simple version works well in many cases, it does have some limitations. Most work items won’t have an item age on their first day of being in progress (in most cases work items will move to in progress after the daily automation has run). It assumes that team members update their tickets promptly and never make mistakes. Experience tells us that this is sadly often not the case, therefore we need to account for scenarios such as:
If this sounds like your setup then this approach is for you, as it has the benefit that it’s more resilient in the face of accidental status changes and gives you the option to override the In progress date (i.e. when people forget to update their ticket when they start work on it).
At a high level, here’s what we’re going to do:
First we need a field to store the date that the work item transitions to in progress. Add a new custom field, choose ‘Date picker’ and give the field the name of In progress date and add a description:
Next, we create a field that will store the age of each work item. Add a new custom field, choose ‘Number Field’ and give the field the name of Work item age and add a description:
This is where things get interesting (and a little complicated). There are a lot of different ways to do what we’re trying to do (the joys of a flexible system). We’ve chosen what we think is a good compromise: reasonably easy to implement; low maintenance; and resilient to user error, system failures and issues with historical data.
Breaking this down into 4 separate rules makes it easier to maintain, test and extend:
We use Status Category in the rules rather than status because this avoids having to hard code statuses into the rules. There are only 3 status categories: To Do (aka New); In Progress; and Done (aka Complete). Note that for this to work consistently, you will have to establish guidelines of what each of these status categories mean (tbh, you should probably do this anyway).
This rule will run every time a work item transitions to a status that has a status category of In Progress. The first time a work item is transitioned to In progress, we’ll set the In progress date. We’ll also use this rule to set the work item age. The logic looks like this:
IF In progress date is blank:
//This is the first time the work item has transitioned to In progress
SET In progress date = Current date
SET Work item age = 1*
ELSE IF Work item age is blank:
//The work item has an In progress date but not a Work item age. This likely means that it has already been in progress before (it may have been moved back to To Do or even to Done)
SET Work item age = (Current date - In progress date) + 1
END IF
*It might seem a bit weird setting Work item age to 1 immediately. We’re doing this for consistency. We’re calculating Work item age (and later Cycle Time) to the nearest day. For example, if we start and finish a work item on the same day, we will calculate the Cycle time as 1 day (essentially rounding up). So we set Work item age to 1 immediately for consistency. The alternative would be to calculate cycle time as 0 days in this case, which wouldn’t make sense. If it makes you feel better, you could think of setting Work item age to 1 as reflecting the fact that this is the first day that the work item is in progress.
Here are the steps for implementing this logic in Jira’s automation rules:
Create a new automation rule, then add the trigger “Work item transitioned”. Leave the fields “From status” and “To status” blank (we leave these blank because we’re going to use Smart values in the next step to check the Status category - this means that you don’t have to hard-code individual statuses into the rule… Smart).
Next, click Add component then select “IF: Add a condition” and then select “{{smart values}} condition” and set the values as follows:
Click Add component then select “IF: Add a condition” and then select “IF or ELSE: Add condition options”. Click Add condition… choose “Work item fields condition” and set values as follows (this step ensures that In Progress date is only set the first time an issue is transitioned to In progress):
Now, in the same branch, click Add component, select “THEN: Add an action” and then select “Edit work item”. Select the fields “In progress date” and “Work item age” then enter the values as follows (adjusting the timezone to your locale):
Next, click Add else and then click Add condition… and then choose “Work item fields condition”. Set values as follows:
In the same branch, click Add component then select “THEN: Add an action” and then select “Edit work item”. Select the field “Work item age”, then enter the values as follows (adjust the timezone to your locale, ensuring that you set the timezone consistently in all rules):
Work item age: {{#=}}{{issue.In progress date.diff(now.convertToTimeZone("Australia/Sydney")).days}} + 1{{/}}
Click Rule details and enter a name and description for the rule, then turn the rule on.
Next we’ll create an automation rule that will run on a daily schedule to increment the Work item age for all work items that are in progress. The logic looks like this:
FOR EACH Work Item in an In Progress status
IF In progress date is NOT blank
//Calculate work item age based on In progress date
SET Work item age = (Current date - In progress date) + 1
ELSE
//Deal with the case where In Progress date has not been set for some reason*
SET In progress date = Date of last status change
SET Work item age = (Current date - Date of last status change) + 1
END IF
END FOR
* This deals with work items that were in progress before adding this automation rule or are missing In progress date for any other reason.
And here are the steps to configure the rule:
Create a new automation rule, then add the trigger “Scheduled”, select the appropriate start date and time, and configure the schedule as follows:
Scroll down a bit further, and tick the box to Run a JQL search and execute actions for each work item in the query then add the following:
Next, click Add component then select “IF: Add a condition” and then select “IF or ELSE: Add condition options”. Click Add condition… and then choose “Work item fields condition” and set values as follows:
In the same branch, click Add component then select “THEN: Add an action” and then select “Edit work item”. Select the field “Work item age”, then enter the values as follows (substituting your timezone):
{{#=}}{{issue.In progress date.diff(now.convertToTimeZone("Australia/Sydney")).days}} + 1{{/}}
Click Add else and leave the conditions blank. In the same branch, click Add component then select “THEN: Add an action” and then select “Edit work item”. Select the fields “In progress date” and “Work item age”, then enter the values as follows click Next (adjust the timezone to your locale):
Click Rule details and enter a name and description for the rule, then turn the rule on.
Phew, that’s the hard ones out of the way. All we’re going to do with this rule is clear work item age when a work item is transitioned to done.
Create a new automation rule, then add the trigger “Work item transitioned”. Leave the fields “From status” and “To status” blank,
Next, click Add component then select “IF: Add a condition” and then select “{{smart values}} condition” and set the values as follows:
Click Add component, select “THEN: Add an action” and then select “Edit work item”. Select the field “Work item age” and leave the field blank (to clear the value).
Click Rule details and enter a name and description for the rule, then turn the rule on.
Finally, we want to clear work item age when work items are transitioned back to a To Do status. The steps for configuring this are identical to rule 3 (transition to Done), except the smart values condition which is configured as follows:
Whichever approach you choose to implement, the important thing is to surface the information so your teams can use it. Here are some of the options that we have thought of - pick the one(s) that you feel will be most useful for your teams.
Card colours are another visual cue that you can add to your team’s Kanban board. To set this up, go to your board’s settings, then set up Card colours using “Queries”. Use your historical data and SLE to inform your choice of cut-offs for different colours.
The effect is quite subtle, but you can see it in action for the work items in In Dev and In Test columns:
There are plenty of other ways to surface work item age for your teams. Some other ideas you could try include:
In our experience, monitoring work item age is transformative for teams. It helps them focus on the right things at the right times. It makes conversations at stand-ups more focused and productive. And it helps teams become more predictable.
Unfortunately, many existing solutions force teams to go through extra steps to access work item age, which increases friction and reduces their chances of using it. We’ve given you 2 approaches in this article to automate tracking and surfacing work item age. So get out there and try it out.
Now that you understand how to automate work item age tracking, you're ready for the next step. In Part 2 of this series, we’ll extend this configuration to track cycle time and explore options for further reporting, don't miss it!