In this blog post we cover the new Templates feature that was first released in TMO version 4.5.

Introduction

Templates are a powerful way to get TMO to automatically populate fields in work items from a set of default values that you setup in a template. You can use any free text value in a template or you can use “Expressions”  that instruct TMO to extract out information from the current selected Outlook mail (or any item) and use those values to fill the work item fields.

You can create as many templates as you like. TMO groups templates based on Collection Url, Team Project and Work Item Type. For e.g. you can have a template named “Default Bug” template under Collection named say Mars but under different projects say “Phoenix” and “Icarus” under Mars. Here is a screenshot of how templates are grouped. For more details on this please read “Managing Templates“.
 

Example and Description of a Template

Consider the following template. We will explain how you get to this screen in the following sections. For now let’s understand what the various fields on this screen mean.

Template Fields

Capturing various fields in the template

 

Here is what the various options mean on this form.

  1. Name – Any name that you want to give to this template. Names don’t have to be unique but we’d recommend that you use unique names so it is easy to identify the templates.
  2. Description – Free text field for you to enter any description for this template
  3. Work Item Type – This indicates what work item type this template corresponds to. Here in this example we are setting up a template to populate a Task work item type.
  4. Set As Default – If this check box is checked then TMO will always automatically use this template whenever you create the specified work item type. In this case it is a “Task”.
  5. Attach outlook item with work item – If this check box is checked TMO will automatically attach a copy of your Outlook email with the work item when it is created.
  6. Copy Outlook attachments to work item – If you check this check box, TMO will take any attachments that are present in the Outlook email and attach them to the work item when it is created
  7. List of all work item fields – Next is a list of all the fields that are present in your TFS for this work item type. This list is not static. TMO automatically finds out all the fields that are setup in TFS for this work item and gives you an option to specify a value for them.
  8. State – This column indicates the State of the field in the Template
    1. New – This is a new field and does not currently exist in the template.
    2. Unmodified – The value for this field has been saved in the Template before and has not been modified yet.
    3. Edited – The value that you see on the screen is different from the value that is saved in the template right now for this field.

 

Expressions in Templates

TMO can extract values of various fields out of Outlook and use those as the values of various fields in your templates. As of writing this blog post following fields are supported. To use them simply use the expression name “exactly” as the value of a field. Please note expressions are case-sensitive.

Expressions Description
[TOEMAIL] This will be replaced by the recipient’s email address in the Outlook email.
[TONAME] This will be replaced by the recipient’s name in the Outlook email.
[BODY] This will be replaced by the body or text of the Outlook email.
[FROMEMAIL] This will be replaced by the sender’s email address in the Outlook email.
[FROMNAME] This will be replaced by the sender’s name in the Outlook email.
[SUBJECT] This will be replaced by the subject of the Outlook email.
[SENTDATE] This will be replaced by sent date of the Outlook email.
[RECEIVEDDATE] This will be replaced by the current date as per your computer’s calendar.
[NOW] This will be replaced by the received date of the Outlook email.

Consider the below template setup

Template Fields

In the above template screenshot TMO will always

  1. [BODY] – Use the Body of the email as the value for the “Description” field as you create a Task.
  2. [NOW] – Populate the current date for the “Created Date” field.
  3. [TONAME] – Use the Outlook Name of the recipient as the value for the Assigned To field in the Task work item.
  4. [SUBJECT] – Use the subject of the email as the value of the “Title” field in the Task work item.

 

Creating a Template while creating a work item.

You can create a template while creating a work item. To do that simply create a work item as you normally would by clicking the New button and selecting the work item type that you want to create. However instead of saving the work item by clicking the “Save” button on the form, click the “Capture As Template” button.

Convert work item into a template

This will open the screen you saw in the Example and description of a Template section. For a description of the fields please see the Example and description of a Template section
 

Creating a template from Scratch

While we recommend creating a new template while creating a work item you can also use the “Add New Template” feature to create a new template. To do this
1. Click the Template Manager button in the TMO toolbar. See screenshot below

Open Template manager to manage TFS templates

Open Template Manager

2. Click the Add New Template button and pick a collection, team project and work item type.
3. This opens up the form for the particular work item type that you can use to enter values for various fields to save them in the template. For e.g. in the screenshot below we have assigned the [BODY] expression to the Description field, [SUBJECT] for the Title of the work item.

Create a new template from scratch for TFS

New Template Window

1. Click the Save As Template button when ready, this will open up the familiar Template Capture dialogue box.
2. Verify all the fields have been captured properly, give the template a name and setup optional settings as explained in the Example and description of a Template section and save it.

The template is now ready for use.
 

Setting a Template as Default

You can set a template as Default Template. Once you do that then every time you create a new work item of that type, TMO will automatically use that Template to pre-fill the values.

 

Managing Templates

You manage templates by launching the Template Manager from the Template Manager button in the TMO toolbar.

Open Template manager to manage TFS templates

Open Template Manager

This launches the following window from where you can manage your templates including adding new templates, setting an existing template as Default Template and deleting templates.

Open Template Manager to manage templates i TFS