Boolean (checkbox) fields on Team Services

checkbox1

The wait is over. With the latest deployment to Team Services, you can now add a checkbox to your work items. To do this, simply add a Boolean field to your work item type.

It’s been a long journey and I’m sure more than one of you is wondering why it’s taken us so long. The simple truth is we just haven’t made it a priority when weighed against the other features we’ve shipped over the years.

There were, however, some technical challenges with no great solutions. One of the key challenges in designing the checkbox was how to handle the tri-state nature of a Boolean field where the field could be True, False, or NULL (unset). We decided to work around this problem by treating NULL and False values the same both in the work item and query experiences. In addition to this, we have a variety of clients we need to make sure work with the new field type from web to Visual Studio to Excel.

In this post, I’ll go into more detail on the special characteristics and behavior of the Boolean field.

Field definition

The first thing you’ll notice when adding a Boolean field is the sparseness of the Options tab. Boolean fields are always required to have a value of either True or False, and the default value for Boolean fields is always False.

checkbox2

Client support

Your Boolean field will show as a checkbox control in the web view of the work item, a text box in Visual Studio Team Explorer, and a 0 or 1 in Excel.

checkbox3

In the web view and Eclipse Team Explorer Everywhere (TEE), check the box to set the value to True and uncheck the box to make the value False.

checkbox4

To set the value for the field in Visual Studio Team Explorer, you must type either “True” or “False” into the text box. This will improve in VS 2015 Update 3 where these Boolean fields will have a dropdown with “True” and “False” values. In VS vNext, we’ll have a checkbox control.

checkbox5

Excel will only accept 0 (False) or 1 (True) as inputs, and there is a dropdown with those values.

The table below summarizes the experience for Boolean fields for various clients:

Client Experience
Web access Checkbox control
Eclipse (TEE) Checkbox control
Visual Studio vNext Checkbox control
Visual Studio 2015 Update 3 Dropdown with True and False values
Other Visual Studio versions Text box that accepts True of False input
Excel Dropdown with 0 and 1 values

New Boolean fields and existing work items

As alluded to earlier, work items with a Boolean field must have a True or False value for that field. So what happens with work items that already exist when you add a new Boolean field? Existing work items will not be updated with a new revision to set the field value.  However, when querying on the Boolean field, these work items will be treated as if they have a False value for the field. Therefore, if you query for False values, you may see some work items have a “False” value and some work items have an empty value.

checkbox6

The work items with an empty value must have 1) existed before the field was added and 2) have not been updated since the field was added. On any update to work items 11 or 12 in the example above, the “Ready for deployment” field will be set either to False (default) or True (if the user sets the field to True).

We believe this is the right compromise between not updating all work items when adding a field while still preserving the expected querying experience. With this approach, searching for work items with the values True OR False will always return all your work items as demonstrated below.

checkbox8

checkbox7

Closing

This post covers special behavior around Boolean fields that I believe is important to document. However, our goal is to bring a checkbox experience to VSTS that is intuitive to use and simple to understand. As you use the new field type, please comment or email with any feedback you have on the Boolean field experience.

Derrick Fu
Program Manager, VSTS

8