Create work items and link to code changes

Completed

Let's discuss creating work items in Azure Boards. You can create work items at different places. Typically, the product owner creates new items using the Work Items menu in the Boards section. In this list, all work items are registered without any order. Depending on the type of the selected process template, the New Work Item menu displays other types. Register every requirement or bug in this list.

Screenshot of the new work item menu.

You can also directly create a work item within a specific iteration. Then the work item will automatically be linked to that iteration.

To create a new Work Item, a page is created with a number of fields, where some are required. The content depends on the type of Work Item. The content can be configured using the templates defined in the Organization settings, as explained in an earlier unit.

Screenshot of the new work item page with required fields.

On the Work Items page, you can find different sections. At the top, you can enter a title for the work item and select the State. With a new work item, this will be set to To Do. Once saved, you change the state to Doing or Done, but you can also change the state by dragging the work item on the Taskboard to another column. Area can be used to group work items, and the Iteration shows in which iteration your work item will be handled.

In the Description field, you can add the content of the work item. Here, you describe what should be developed. In the Planning field, you can prioritize the work item by assigning a number from 1 to 3.

  • 1: Product can't ship without the feature.

  • 2: Product can't ship without the feature, but it doesn't have to be addressed immediately.

  • 3: Implementation of the feature is optional based on resources, time, and risk.

On the Effort field, you can put an estimate on how long it would take to develop this feature.

Screenshot of the New Work item details.

On the right side of the page, you can see another section that displays information on Deployment, Development, and Related Work.

Screenshot of the Deployment, Development, and Related Work information.

The Deployment section will display all releases that are linked to this work item. This can be done by adding a work item to a pull request that is used to merge and start a build, but also if you link your work item to your code changes using the commit message.

If a work item is linked using the commit message, you'll see the commit displayed in the Development section.

In the Related Work section, you can link to other work items or create a new task. With the link, you can indicate that a work item can only be started when another work item has finished. When you create tasks, they'll be linked to an Issue work item and automatically be displayed in this section.

Screenshot of the Related work section.

To add a work item to your code changes, the only thing you need to do is add the number of your work item to the commit message in Git. So, if we look at a work item (in this example a Task), you can see the number of the work item in front of the title. Here it is number 43.

Screenshot of the work item number in front of the title.

In Visual Studio Code, you can use this number in the Git commit message. You need to put a hash-sign in front, so #43 will link your code to the work item.

Screenshot of linked commit to work item.

By linking work items to commits, these work items will automatically be linked to your pull requests as well. When you use a commit that has a linked work item in your pull request, you'll see the work item linked. You can always add extra work items to a pull request, by using the dropdown menu where you can search by ID or title.