Child item templates in Azure DevOps

Florian CAILLAUD
Published by Florian CAILLAUD
Category : DevOps / VSTS
01/06/2020

In some Azure DevOps projects, the same tasks are found repeated in certain types of work item, such as User Stories (Documentation, Unit tests, etc.). In order to avoid creating these tasks manually (or using Excel) every time, we can put templates in place.

Actually, Azure DevOps does make it possible to create work item templates natively (see the documentation here). But unfortunately, there is no way to define Child links, or even to create child items.

To do so, we are going to use the extension called 1-Click Child-Links.

 

Installing the extension

The extension in question can be found at the address here.

Next, by clicking on Get it free (it being free of charge) you can select the organization on which the extension is to be installed.

For information, the corresponding source codes for the extension are available on GitHub, here. Please note, the documentation is not extensive and some functionalities are not implemented yet.

 

Using the extension

 

Creating the template

First, you need to create the template for each task you want to see appear under our parent work item (here, it will be a User Story).

 

DevOps Template Creation

 

 

Under the Project Settings, in the Teams configuration menu, Templates tab, a list of the available work items is shown. By clicking on New Template in the section for our work item (here, a Task), the following form is displayed:

 

DevOps Template Configuration

 

The template name is a mandatory field. It is possible to configure all the fields for the task (and even to create a default “Comment”). The only restriction is that the template description cannot be changed.

This description must contain a JSON tag of the following type:

{
    "applywhen":
    [   
        {       
            "System.Tags" : "PROD",       
            "System.WorkItemType": "User Story"   
        }   
    ]
}

These JSON fields describe the conditions under which the task template in question will be used to create a child item. In this case, the task template will be used if the parent item is a User Story and it has a “PROD” tag.

Other parameters can also be used, to customize the conditions for use. It is also possible to give more than one condition. To do this, please see the extension documentation.

 

Creating a User Story

Once the template has been saved, we can see how to use it. The video below shows how to create a User Story (which is our parent item). After entering the item title, adding the “PROD” tag and saving it, we can use the “1-Click Child-Links” functionality to create a certain number of child items.

 

 

Lastly, users should know that it is possible to transfer a number of properties from the parent item to the child item, such as the person assigned, the Sprint, the Area, etc. For that porpose, the list of such properties can be found here.