27Oct
How to Prevent Users from Moving Task to Closed State with a non-Zero value Remaining Work field in VSTS/TFS
One workflow problem we see in VSTS/TFS projects is people move the Task to Closed or Resolved state without updating the Remaining Work to Zero which leads to some incorrect project reports. In theory, there should be no Remaining work for Closed or Resolved Tasks. One of our customer had this below requirement. Wanted share how we customized the template to make it work as questioned below
Can we perform a check that prevents people from moving the state of a Task to Resolved or Closed with a non-zero Remaining Work?
We can achieve this by customizing the TFS/VSTS work item template in two ways. The 1st option will not allow the user to move the Task from Active to Closed state with a non-zero value in “Remaining work” field whereas 2nd option sets the remaining work to Zero when user moves the Task from Active to Closed state.
- Using the ALLOWED VALUES Rule on the Transition to the Closed state.
- Using the COPY Rule on the Transition to the Closed state.
- Using the ALLOWED VALUES Rule on the Transition to the “Closed” State.
- Export/Download the process template and open the Task work item template in any text editor.
- In the Transition to the “Closed” state add the below rule to the field Microsoft.VSTS.Scheduling.RemainingWork
This rule won’t allow the users to move the Task from Active to Closed state with a non-zero Remaining work.
Verification:
Task is currently in Active State

When we move this task to Closed State It won’t all non-zero remaining work and it will show “0” as allowed value in the dropdown.

So, this way we can perform a check that prevents the users from moving Task to “Closed” state with non-zero Remaining work
2. Using the COPY Rule on the Transition to the “Closed” state.
Same requirement can also be achieved by using COPY rule on the transition to “Closed” state. We need to replace the above code snippet with the below code

This rule will set Remaining work to 0 after transitioning a Task work item from “Active” to “Closed” state.
The task is now in Active state.

When user move this Task to Closed State Remaining work is Set to Zero as shown below

We can see the same in work item history.

Related
How to scale the application in Azure App Service. There are two workflows for scaling, scale up and...
Read More >
In this blog we will see what is Azure App Service, and it’s features and why do we use it, we can...
Read More >
In this blog we will talk about introduction to Azure DevOps Sever earlier called as Team Foundation...
Read More >
DevOps can be defined as an approach to enable seamless application delivery from inception to produ...
Read More >
This blog is intended to see how Microsoft Dynamics NAV (here onwards NAV) can be connected to exter...
Read More >
This blog is intended to see how Microsoft Dynamics NAV (here onwards NAV) can be connected to exter...
Read More >
Hi All, if you are worrying how to do DevOps for Java in VSTS, here is the solution. I’m going to e...
Read More >
Hi all, today in this post I'm gonna talk about "Implementing Security to your DevOps Pipel...
Read More >
Hi All, Here i'm going to explain How VST...
Read More >
Hi All, if you are worrying how to calculate sum of the effort fields in VSTS, here is the solution....
Read More >
Share