Timepiece - Time in Status for Jira

How to Set Original Estimate Field Using Timepiece Status Duration Data

Business Need

You need an automated process that uses historical Timepiece data from previously completed work items in the project to estimate work item durations and set a realistic Original Estimate field.

Solution

“STATUS DURATION” report type of Timepiece, combined with Jira Automation, can be used for this purpose.

Step 1: Configure and Save the Timepiece Report

First, create a Timepiece report...

  • Open the Timepiece reporting page.

  • Select the project in which the support issues reside (Let’s presume you have selected the ABC project).

    • Any filter selection at this point works. The selection made at this stage is not critical, as it will be overridden later during the automation configuration.

  • Switch to the “STATUS DURATION” report type.

  • (Optional) Select your business calendar if you have one.

  • Create a consolidated column and add all statuses included in the development process to this column.

A Timepiece report view highlighting the Statuses dropdown configuration menu
  • Configure the Report Options as shown below.

    • Set the "Show report as" option to "Average of value across issues" to calculate the team's mean velocity.

    • Leave the 'Group issues by' field blank. Leaving this field empty ensures that a single average is calculated for all the records selected by the user.

A Timepiece report view highlighting the Average of Total dropdown options menu, configuring the report to show average values across issues with non-empty values only
  • Go to settings and save it via "Save report parameters".

    • The parameter set name should be like “Predict Target Completion Dates Automation Flow”

    • Make sure you select the "Share with everyone" option so others can use the param set as well.

Step 2: Create a Jira Automation & Set General Flow Details

Navigate to Jira Automation and start a new rule.
Before configuring the automation logic, you must define the administrative settings in the Flow Details section.

Step 3: Define Trigger and Conditions

Use the “Work item created” trigger to start the automation whenever a new work item is created. Since our goal is to analyze how long issues take to be completed in this project and add this information as a comment on the ticket, we initiate the automation at this specific event.

configuring a Work item created trigger step

Step 4: Add Action - Timepiece: Run Report

After defining the trigger and conditions, add a “Timepiece: Run Report” action that will fetch the required data from Timepiece.

An ABC Project Cycle Time Automation interface showing an Add a step configuration menu offering Action Condition
In Progress to Resolved Automation-Add Timepiece.png

Select the report (Parameter Set) you created for this automation in the Report Settings field. Ensure that the report has been previously saved using the “Save Report Parameters” option.

configuring a Timepiece Run Report action step using a specific Parameter Overrides JSON block

Parameter Overrides

Override some report parameters with a custom JSON. We’ll override the report filter so it returns data only from historical work items in the same project, excluding the issue that triggered the automation.

Parameter Overrides:

{
"filterType": "customjql",
"customJql": "key != {{issue.key}} and project = \"{{project.name}}\" and type = {{issue.issueType.name}} and updated >= startOfMonth()",
"viewFormat": "Hours"
}

Step 5: Add Log Action (Optional)

Add a Log Action to your flow. This step is necessary if you want to monitor the automation and helps debug in the event of an error.
This action writes the entire dataset returned from the report as a log output, allowing you to see all available data at once.

Log Message: resultList: {{fetchedTimepieceResultList}}

configuring a Log action step

Note: For more details about the logging and debugging, see the documentation.

Step 6: Create Variable

In this step, we extract the duration of the “In Development” status from the dataset and assign it to the InDevelopmentDuration variable so it can be used in later actions.

Variable Name: InDevelopmentDuration
Smart Value: {{fetchedTimepieceResultList.first().get("InDevelopment").asNumber}}

configuring a Create variable action step

Step 7: Edit Work Item Fields

In the Edit work item fields step, we directly update the Original Estimate field using the data collected in previous steps. The Original Estimate field is updated with {{iInDevelopmentDuration}}, the recalculated date value computed in an earlier variable step.

Original Estimate: {{InDevelopmentDuration.asNumber}}

configuring an Edit work item fields action step

Step 8: Add Comment to Work Item

In this step, the automation adds a comment directly to the work item summarizing the calculation results. Using the data retrieved from the Timepiece report and the calculated variables, the comment shows the average resolution time for similar work items and the newly calculated Original Estimate value, providing clear visibility into the result for that specific work item.

The automation adds the following comment:

In the last month, in the "{{project.name}}" project, work items of type {{issue.issueType.name}} have been resolved within {{InDevelopmentDuration.asNumber().round()}} hours. Estimated Hours have been set to {{fetchedTimepieceResultList.first().get("InDevelopment").asNumber().round()}}. This issue is expected to be completed on {{now.plusBusinessHours(InDevelopmentDuration.asNumber).fullDate()}}

configuring a Comment on work item action step

Step 9: Enable the Rule

Click the “Turn on rule” button to activate the automation.

Once enabled, the automation will automatically add a comment to new work items, retrieving the average resolution time from the Time in Status app based on previously completed work items in the project and providing visibility into the expected completion duration.

A Jira work item detail view highlighting an automated comment