Adding Custom Team Field to MS Project Mappings
Note: This post is NOT about TFS and Project Server integration – this is for adding, editing and deleting work items using MS Project.
I was working with a customer who are using a custom field (called “Team”) instead of Area Path to denote “ownership” of work items to teams. You can find out how to do this on Martin Hinshelwood’s excellent post. So I did the customization (the team is working off MSF Agile, and not the Scrum template, but the steps are the same). Everything was looking great.
Then their project managers (who work a lot in MS Project) started adding work using the MS Project. However, once they added in the User Stories, the items did not appear on the Backlogs. I realized that this is because the Backlogs are filtered to Team – any work item that does not have the Team field set (when using a custom team field) won’t show for the team.
The solution: customize the Team Project “TFSFieldMapping” – this is the file that controls how Work Item fields map to MS Project fields.
Customize TFSFieldMapping
First, you have to download the mapping file. Open up a VS command prompt and navigate to this folder:
%programfiles%\Common Files\microsoft shared\Team Foundation Server\11.0
(This is a different folder than previous versions of TFS for some strange reason).
Run the following command:
TFSFieldMapping download /collection:CollectionURL /teamproject:ProjectName /mappingfile:MappingFile
where collectionURL is the URL to your collection, ProjectName is the name of your Team Project and MappingFile is the file you want to create.
Now edit the file in your favourite editor and add the following line:
<mapping workitemtrakingfieldreferencename="”Custom.Team”" projectfield="”pjTaskText27”" projectname="”Team”"></mapping>
Of course the reference name is the reference name of your custom team field. The ProjectName attribute is a friendly name for the field – this will actually be the column name in Project. The project field is an unused field in the project plan (to see these, open Project and add a new column to the plan – the fields that display here are the fields that you need to use for the mapping – see the below picture).
Now you can upload the mapping file again:
TFSFieldMapping upload /collection:CollectionURL /teamproject:ProjectName /mappingfile:MappingFile
Now when you open up a project plan, you’ll be able to add the “Team” field:
The column will even get its values from your global list:
Now when you add work using MS Project, you can select the Team and the work will appear on the Backlogs accordingly. Of course this technique will work for any other fields too.
Happy Mapping!