Friday 12 July 2024

Restrict State Transitions in Azure DevOps Work Items

 Azure DevOps work items for example User Story work item can be moved from one state to another in a workflow. As per this question in tech communties a requirement is there to resrict a New state user story from moving to Closed state directly. But if the uer story is in another state such as Active it should be able to moved to Closed state. Let's explore how to implement a solution for this Azure DevOps.

We can use customized templates in Azure DevOps to customize the work items and work flows. To restrict moving a user story from New to Closed state we can implement a rule in user story work item as below.

  • Open custom template user story work item.
  • Then go to rules tab and add a new rule.
  • Provide a rule name. 
  • Add condition "Work item state is moved from" and select New as the value.
  • Add action "Restrict transition to state" and select Closed as the value.


When the above rule is saved for user story work item in the custom template, the user story will not allow moving from New to Closed state.

A user story in New state does not show the Closed state.


If you drag and drop a user story from New to Closed in the board, an error will be shown and when you refresh the board, it will be still in the New state as New to Closed move is restricted.


When you move the user story to other states for example Active in this example, it allows transistion to Closed state.




No comments:

Popular Posts