Autocomplete work items with pull requests

Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019

When you link a work item to a pull request (PR), you can automatically complete those work items when you complete the PR. Or, you can specify the workflow state to transition the work item to upon merging the PR.

When you link a work item to a pull request (PR), you can automatically complete those work items when you complete the PR.

To learn more about pull requests, see Create, view, and manage pull requests.

Autocomplete work items

As shown in the following image, check the box to Complete linked work items after merging. The system defaults to your selection for future PRs.

Complete pull request dialog, Complete linked work items after merging

Complete pull request dialog, Autocomplete work items with completion of PR option

In the following circumstances, the system won't automatically update the work item state to Done, Closed, or the state that belongs to the Completed category for the work item type:

  • The work item, whose work item type is managed with the Inheritance process model, is already in a State that belongs to the Resolved category. In this instance, the system won't update the State. For example, if a bug derived from the Agile process is in a Resolved state, the system won't transition it to Closed.
  • The work item is already in a State that belongs to the Completed category. No further transition is required.
  • The WIT associated with the work item contains one or more workflow field rules that prevent the work item being saved to a next state. For example, a rule requires that another field must be defined as part of closing the work item.
  • For on-premises deployments and Azure Boards Hosted process model, you must modify the workflow to specify actions (ACTION element) to take place when transitioning the workflow. See Change the workflow for a work item type, Specify Actions.

To learn more about process models, see Customize your work tracking experience.

Specify the workflow state of linked work items

To transition a work item to a specific workflow state, you can enter the information in the pull request Description. Prefix the #ID with a valid workflow state for the work item you mention.

Note

This feature requires Azure DevOps Server 2020.1 update or later version.

As shown in the following image, two user stories are transitioned, one to Resolved and the other to Review. Also, two tasks are set to Done.

Screenshot of pull request, set workflow state to transition #ID work items.