Last updated: August 16, 2019

Controlling the process manually is challenging

Enforcing process is hard when there are many people within the team using task management tool like Azure DevOps. I have a process that once a work item is closed then it should not be reopened even if it was allowed in Azure DevOps. People tend to forget the process and in the sense of urgency and/or their convenience, they just override the protocols by doing what they want to. I don’t blame anyone. Thankfully, you can control the process of work items in Azure DevOps through setting a few rules for your work item types in Azure DevOps process settings. The tip below provides step-by-step guidance on how to lock or freeze closed work items using Rules in Azure DevOps settings to control your DevOps process. It uses a hack that is called out below.

Why prevent reopening a task after it’s closed

The short answer is to have a better control on processes and workflows. It also helps provide more accurate team utilization metrics using Azure DevOps for reporting on or analyzing operations. For example, let’s say that a task is submitted to update a page’s content and once all of that is processed and the task status is set to closed, task requestor may reuse the same task to carry out further updates. Using the same task item for iterative updates can incorrectly reflect either the time taken by resources to close the task or total number of tasks processed within a month by the team. Hence, a control through the system is needed.

Reopening a task from “Resolved” (vs. Closed) state is still often allowed but after a no response for a set time like 24 or 48 hours (varies by teams and organizations), tasks are typically closed and should be locked. Freezing a task from reopening, once its status is set to “Closed”, enforces the users to submit a new work item for further updates instead of requesting the updates through the same closed task.

Solution – How to set up rules to prevent reopening of work items in Azure DevOps

You can watch the video below to see it in action but if you want to go old school method, keep reading below.

Go to the process page at https://dev.azure.com/{org-name}/_settings/process. Go to your inherited process that contains the work item for which you want to apply this rule.

Rules are allowed only in inherited process for work items. See manage process on Azure DevOps. Once you are on the inherited process page, click on the work item that you want to set rules for. In our example, it is the Bug work item. Click on Rules tab and then click “New rule” Set below rules iteratively until rules are created for all states other than the “Closed” state. Name: “Prevent Closed to New” Condition: When — “A work item state changes from” — “Closed” — to — “New” Action: “Make read only” — “System.State” (this will show you a validation error but go ahead and save it!) This is the hack.

Do the above for each of the states that you want to lock from changing from “Closed”. Finally, add a rule below to lock fields when state is Closed: Name: “Lock Fields when Bug is Closed” Condition: When “A work item state is” — “Closed” Actions: Set “Make read only” for each of the fields. In my example of the Bug work item, I set this action for “Title” and “Repro Steps”. You are all set!

This should now prevent changing of title and/or repro steps field of any Bug work item when it is in Closed state while also preserving the state once it is closed.

If you run into any issues, ask via comments or watch the video above to see it in action.

Cheers,

Aditya

Consider reading: