Prevent a Transition If No Time Logged

 

 

You may want to ensure that work has been logged on an issue before the issue can be transitioned to the next status. Depending on the situation, you can do this with either a workflow condition or a workflow validator:

 

Condition

  • Is checked before the user is given the opportunity to transition an issue. If the condition fails, then the transition buttons will be hidden.

  • The Time Spent condition ensures time was logged on any previous status.

Validator

  • A validator is executed when an issue is transitioned. If the validation fails, the issue will not be able to transition to the next status.

  • The Clockwork time logged validator ensures time was logged in the status the issue is transitioning from.

 

Create a Workflow Condition

You can create a workflow condition to ensure that must have time logged before it can be transitioned to a status.

Go to Jira Settings > Issues > Workflows. Find the appropriate workflow and click Edit. From the Diagram mode, click on the transition arrow. (Note that if you have more than one transition going to the Done status, you’ll need to create a condition for each transition.) A popup window will open showing behaviors that can be added to the transition.

Click on the word Conditions and click the Add condition button. Select Value field and click Add. A new page will open. Select Time Spent as the Field, > as the condition, 0 as the value and Number as the comparison type. Click Add.

Note that this condition only checks that some time was spent on the issue. It does not check when the time was logged, who logged the time or what status the issue was in when the time was logged.

 

Click Publish draft. Now an issue cannot be transitioned to the DONE status without logged time.

 

You can put a workflow condition on any transition, not only the transition to DONE.

Limitations

Note that the workflow condition:

  • Only works in Company-managed/Classic Jira projects.

  • Will pass if there is any time logged on the issue, regardless of the user who logged the time.

  • Will pass regardless of which status the issue was in when time was logged.

Create a Workflow Validator

The Clockwork time logged validator can be set on any transition in a workflow to ensure that time spent is logged before an issue can be moved to another status; regardless of whether the issue is being transitioned manually, via automation or with an API call.

The time logged validator is available only available in Clockwork Pro.

Two steps are required. First you need to add a validator to the appropriate transition(s) in your Jira workflow. Second, you need to enable validation in the Clockwork project settings.

Configuring the Workflow Validator

Go to Jira Settings > Issues > Workflows. Find the appropriate workflow and click Edit. From the Diagram mode, click on the transition arrow. A popup window will open showing behaviors that can be added to the transition.

 

Click on the word Validators and click the Add validator button. Select Clockwork time logged and click Add. Click Publish draft to save the changes to you workflow.

Enable the Validation Setting

Navigate to Project Settings > Clockwork and select the Time Tracking tab. Use the toggle to enable Time is logged validation.

 

Disabling Validation

If you wish to disable a validation rule, remove the validator from the Jira workflow first. Disabling the Time is logged validation in project setting prior to removing the workflow validator can result in issues becoming indefinitely blocked from transitioning.

Limitations

Note that the validator:

  • Only works in Company-managed/Classic Jira projects.

  • The Clockwork time logged validator does not take into account time that was logged before the validator was put in place. For issues with existing worklogs, you will have to update the worklog (or create a new one) to trigger a recalculation of Clockwork validation state.

  • Although it is sufficiently reliable for common usage, there may be circumstances beyond Clockwork’s control (network latency, Atlassian incidents, etc.) that allow the transition to occur even if there is no time logged.