azure-devopstfstfs-workitem

Add constraint to change TFS task state to resolved


For TFS task, is it possible to add constraint when someone tries to change its state to "Resolved"? The purpose is to specify that the task can only be changed to resolved if someone has reviewed and approved it.

Other option

If "Test" is specified, then "Test Outcome" must be "Pass" in order to change the state to "Resolved".


Solution

  • Per the requirement to set constraint to change the state of a work item, we can leverage work items rules as suggested in this document on Restrict workflow transitions, apply rules to workflow states - Azure DevOps Services | Microsoft Learn

    Here are some simplified steps as a sample for your reference.

    1. Created a custom work item field of Approved by for the Task work item type in the inheritance process; Image

    2. Add the following the work item rules;

      • To make the field Approve by read-only, when current user is not member of group of Project Collection Administrator (or any other group you prefer); and

      • To make the field Approve by required, when the state of a Task is to be changed to Resolved; Image

    3. When a user who is not a member of the PCA group is trying to change the state of a Task to Resolved, the user will be prevented by the failure in updating the required Approved by field; Image

    4. While one of the PCA group members is able to change a Task to the Resolved state and update the Approved by field; Image

    To ensure a smooth transition, we recommend creating a test process and project, which allows you to test your customizations before you implement them organization-wide. Please go throught the document above for more examples/scenarios with more details.