Customize the Field Mapping Between Project Server and Team Foundation Server
To synchronize data between an enterprise project plan and a team project, you must associate the work-item fields in Visual Studio Team Foundation Server 2012 with the fields in Microsoft Project Server. You can add fields and specify how they synchronize by customizing the field mappings. You can map both built-in and custom fields in Project. For example, you can share data that does not relate to schedules (such as cost centers, team names, or health status) if you add the fields that store these types of data to the mappings.
You maintain one set of field mappings for each team project collection that hosts team projects that you want to synchronize with Project Server. You must define the field mappings for each team project collection that you have mapped to an instance of Project Web Access or Project Web App (PWA). You can upload the default mappings, or you can customize a mapping file and upload it. To upload the default mappings, see Upload Mappings later in this topic.
Warning
The mappings for the integration of Team Foundation Server (TFS) and Project Server are distinct from the mapping file for Microsoft Project. For more information, see The Microsoft Project Field Mapping File.
As the following illustration shows, you customize the mappings in five steps:
Customizing the Field Mappings Between Team Foundation Server and Project Server
Important
You can update the mapping file as often as you want. The fields that appear on the Project Server tab are updated for each type of work item that participates in data synchronization. You must not manually change the definitions for the Project Server tab. For more information, see Customize the Project Server Tab later in this topic.
In this topic
Default Mappings
Determine Additional Fields to Map
Download Mappings to a File
Update Mappings
Upload Mappings
(Optional) Customize the Project Server Tab
Note
For a demonstration video, see the following page on the Microsoft website: Managing Field Mappings for Integration of Team Foundation Server and Project Server.
Required Permissions
To complete the procedures in this topic, you must have the Administer Project Server integration permission set to Allow. In addition, the service account for Team Foundation Server must be granted the Administer Project Server integration. For more information, see Assign Permissions to Support Integration of Project Server and Team Foundation Server.
Default Mappings
The mappings determine which fields get synchronized when a user updates information in Team Foundation or Project Server. Each of the following synchronization types has its own set of mappings:
For publish synchronization, the data in Project Server updates the data in Team Foundation. You use the targetToTfs element to specify the field in Project Server that updates the field in Team Foundation.
For status synchronization, the data in Team Foundation is submitted to the status queue in Project Server. You use the tfsToTarget element to specify the field that updates the status queue field in Project Server.
For more information about these two types of synchronization, see Overview of the Synchronization Process for Team Foundation Server and Project Server Integration.
The following table lists the default set of fields that are mapped between Team Foundation and Project Server. The table also indicates which types of work items use the fields based on the default process templates that TFS provides. You should not modify these mappings if you are mapping to a team project that was created from a process template that is based on Agile Software Development or Capability Maturity Model Integration (CMMI) Process Improvement. If you are mapping to a team project that was created from the Scrum process template, you will need to make some modifications as Required Changes to Make When Mapping to a Team Project That Was Created From the Scrum Process Template describes later in this topic.
For more information about mappings and the synchronization process, see Field Mapping XML Element Reference for Integration of Team Foundation Server and Project Server.
Team Foundation field |
Project Server field |
Status Queue field |
Work item types in Agile |
Work item types in CMMI |
Work item types in Scrum |
---|---|---|---|---|---|
Title |
Task Name |
Title |
All |
All |
All |
Assigned To |
Resources |
Resources |
All |
All |
All |
Completed Work |
Task Actual Work |
Resource Actual Work |
Task |
Task |
None |
Remaining Work |
Task Remaining Work |
Resource Remaining Work |
Task |
Task |
Task |
Original Estimate |
Baseline Work |
|
Task |
Bug, Change Request, Issue, Requirement, Risk, and Task |
None |
Start Date |
Task Start |
Resource Start |
Task and User Story |
Task and Requirement |
None |
Finish Date |
Task Finish |
Resource Finish |
Task and User Story |
Task and Requirement |
None |
Back to top
Required Changes to Make when Mapping to a Team Project that was Created from the Scrum Process Template
There are two changes you must make to enable data flow from a team project created from either a Scrum 2.0 or a Scrum 1.0 process template. You must add the Completed Work and Original Estimate fields to the Task work item type, and you must remove the elements that require the Remaining Work field to be empty when a team member changes the state to Done or Removed.
To update the Scrum task type definition
Open a Command Prompt window where either Visual Studio or Team Explorer is installed and enter:
cd %programfiles%\Microsoft Visual Studio 11.0\Common7\IDE
On a 64-bit edition of Windows, replace %programfiles% with %programfiles(x86)%.
To export the type definition for Task, type the following command, substituting your data for the arguments that are shown here, where CollectionURL specifies the URL of a team project collection, ProjectName specifies the name of a team project defined within the collection, and "DirectoryPath\FileName.xml" specifies the name and location for the file to export. Then choose Enter.
witadmin exportwitd /collection: /p:"ProjectName" /n:"Task" /f:"DirectoryPath\FileName.xml"
In a text editor or in Visual Studio, open the file you exported.
Within the FIELDS definition section, add this code snippet before the element for Remaining Work:
<FIELD name="Completed Work" refname="Microsoft.VSTS.Scheduling.CompletedWork" type="Double" reportable="measure" formula="sum"> <HELPTEXT>The number of units of work that have been spent on this task</HELPTEXT> </FIELD> <FIELD name="Original Estimate" refname="Microsoft.VSTS.Scheduling.OriginalEstimate" type="Double" reportable="measure" formula="sum"> <HELPTEXT>Initial value for Remaining Work - set once, when work begins. </HELPTEXT> </FIELD>
Within the <WORKFLOW> section, remove the following code snippet from both <STATE value="Done"> and <STATE value="Removed"> definitions:
<FIELD refname="Microsoft.VSTS.Scheduling.RemainingWork"> <EMPTY /> </FIELD>
Within the <FORM> section, add the following Control elements:
<Control FieldName="Microsoft.VSTS.Scheduling.OriginalEstimate" Type="FieldControl" Label="Original Estimate:" LabelPosition="Left" /> <Control FieldName="Microsoft.VSTS.Scheduling.CompletedWork" Type="FieldControl" Label="Completed:" LabelPosition="Left" />
Save and close the file.
Import the file, substituting your data for the arguments that are shown.
witadmin importwitd /collection: /p:"ProjectName" /f:"DirectoryPath\FileName.xml"
Refresh your team project or work items page to verify the changes.
For more information, see Export and Import Work Item Types from an Existing Project, Define Work Item Fields, and Design and Customize a Work Item Form.
Back to top
Determine Additional Fields to Map
Determine the following information for each field that you want to synchronize in addition to the default fields:
The reference name of the field in Team Foundation. If you want to synchronize a field in Project Server with a field that you must create in Team Foundation, first create the field in each type of work item that you are synchronizing. For more information, see Work Item Field Reference for Visual Studio ALM and Define Work Item Fields.
The name of the field in Project Server that will update the field in Team Foundation. For a list of available fields, see Restrictions on Mapping Project Server Fields for Integration with Team Foundation Server.
The name of the field in to be updated in Project Server and the name of the field in Project Server that will update the mirror field in Team Foundation Server will update.
Whether to display the fields on the work item form. You set the value of the displayTfsField attribute to true for fields that you want to appear on the work-item form. You set the value of the displayTfsMirror attribute to true for work-item form.
Whether to resolve data conflicts by allowing the value of the field in Team Foundation to overwrite the value of the field in Project Server or to maintain both values. This decision determines the value of the onConflict attribute. When onConflict=”PsWins” is set, the value of the field in Project Server overwrites the value of the field in Team Foundation. For more information, see Field Elements and Attributes.
Additional values that you must define to support pick lists or custom lookup tables in Project Server.
Back to top
Restrictions on Data That You Can Map
After you determine which fields you want to map, note the following restrictions:
You can send only task-level information, pjTask* fields, from Project Server to Team Foundation Server.
You can send only resource-level information, pjResource* fields, from Team Foundation Server to the status queue of Project Server.
The Title field is the only field that you can send both to Team Foundation Server and to the status queue.
Rollup is automatically calculated for the Assigned To, Completed Work, and Remaining Work fields. You cannot map additional fields and have rollup calculated for them. For more information, see Working with Resource Rollup in Enterprise Projects Mapped to Team Projects.
You must make sure that the data types or units of each field that you map conform to the field mapping criteria for standard and custom enterprise fields. For more information, see “Data Types and Field Mapping Criteria” in Restrictions on Mapping Project Server Fields for Integration with Team Foundation Server.
You can map fields that are associated with pick lists in Team Foundation. However, you must create lookup tables in Project Server to match the pick lists. You cannot automatically synchronize pick lists and lookup tables.
For more information, see Restrictions on Mapping Project Server Fields for Integration with Team Foundation Server.
Back to top
Example: Mapping the Team Name to Appear in Project
In the following example, the custom string field in Team Foundation, MyCompany.MyOrg.DevTeamName, is mapped to an enterprise custom text field in Project Server, My Company Team Name. You can use this example to display in Project Professional the name of the team that is associated with a task.
<field tfsName="MyCompany.MyOrg.DevTeamName" tfsMirrorName="Mirror.MyCompany.MyOrg.DevTeamName" displayTfsField="false" displayTfsMirror="false" onConflict="DoNothing">
<tfsToTarget>
<target provider="ProjectServerStatusQueue" name=" My Company Team Name" />
</tfsToTarget>
<targetToTfs>
<target provider="ProjectServerPublished" name=" My Company Team Name" />
</targetToTfs>
</field>
Neither field appears on the work item form. Also, if the values do not match, each field retains its own value.
Back to top
Example: Displaying the Area and Iteration Paths in Project
You can map the Area (System.AreaPath) and Iteration (System.IterationPath) fields in Team Foundation so that they appear in your project plans. Because these tree path fields change frequently, you should map them as text fields in Project. Project managers who use these fields must manually enter the full area path or iteration path.
Important
The current implementation of Team Foundation Server and Project Server integration does not support automatic synchronization of allowed value lists, pick lists, global lists, or tree path lists that are defined for mapped fields between the two server products. For the best experience, you must make manual entries in the project plan that match those in Team Foundation. If you specify an entry that is not valid, a validation dialog box will appear when you publish the plan.
To add the Area and Iteration fields to a project plan, perform the following actions:
Add two customer enterprise fields to Project Server, and label them as Area (TFS) and Iteration (TFS).
For more information, see the following page on the Microsoft website: Creating Lookup Tables and Enterprise Custom Fields.
Export the field mappings from the team project collection where the team projects are defined.
For more information, see Download Mappings to a File later in this topic.
Add the following code to the file:
<field tfsName="System.AreaPath" tfsMirrorName="Mirror.System.AreaPath" displayTfsField="true" displayTfsMirror="true"> <tfsToTarget> <target provider="ProjectServerStatusQueue" name="Area (TFS)" /> </tfsToTarget> <targetToTfs> <target provider="ProjectServerPublished" name="Area (TFS)" /> </targetToTfs> </field> <field tfsName="System.IterationPath" tfsMirrorName="Mirror.System.IterationPath" displayTfsField="true" displayTfsMirror="true"> <tfsToTarget> <target provider="ProjectServerStatusQueue" name="Iteration (TFS)" /> </tfsToTarget> <targetToTfs> <target provider="ProjectServerPublished" name="Iteration (TFS)" /> </targetToTfs> </field>
Import the updated field mappings file as Upload Mappings describes later in this topic.
Synchronize your project plan with Project Server.
Add the two new columns for the new fields, Area (TFS) and Iteration (TFS), to your project plan
Changes made to the Area and Iteration fields in Team Foundation will be synchronized with these fields in your project plan. Also, you can update these fields in Project and publish your changes to Team Foundation if you specify values that have been defined in Team Foundation.
Back to top
Download the Mappings to a File
Note
You can download mappings only from a team project collection to which they have been uploaded. If you want to download the default mappings to a file, you must first upload the default mappings, as described in To upload the default mappings later in this topic. As an alternative, you can copy the contents of the default mappings. For more information, see Default Field Mappings.
To download the mappings to a file
To run the TfsAdmin command-line tool, open a Command Prompt window where either Visual Studio or Team Explorer is installed and enter:
cd %programfiles%\Microsoft Visual Studio 11.0\Common7\IDE
On a 64-bit edition of Windows, replace %programfiles% with %programfiles(x86)%..
Type the following command, and then press Enter.
TfsAdmin ProjectServer /DownloadFieldMappings /collection:tpcUrl /filePath:MappingFile
Replace tpcUrl with the uniform resource locator (URL) of the team project collection, and replace MappingFile with the path and name of the file that you will customize.
Wait until the following messages appear:
DownloadingMappingFileto Team Project CollectiontpcUrl.
You have successfully downloaded field mapping fileMappingFileto Team Project CollectiontpcUrl.
Back to top
Update the Mappings
For each field that you want to add to the mapping file, you specify the field element and its subelements and attributes. For more information, see Field Mapping XML Element Reference for Integration of Team Foundation Server and Project Server.
Back to top
Upload the Mappings
You upload mappings by using the UploadFieldMappings command. You can upload the default mappings by using the /usedefaultfieldmapping option. Otherwise, you must specify a file that contains the mapping elements.
To upload the default mappings
At the command prompt, type the following command, and then press ENTER.
TfsAdmin ProjectServer /UploadFieldMappings /collection:tpcUrl /usedefaultfieldmappings
Replace tpcUrl with the URL of the team project collection.
Wait until the following messages appear:
Uploading default field mappings toCollectionUri.
You have successfully uploaded field mappings to collectionCollectionUri.
To upload the mappings from a file
At the command prompt, type the following command, and then press ENTER.
TfsAdmin ProjectServer /UploadFieldMappings /collection:tpcUrl /filePath:MappingFile /force
Replace tpcUrl with the URL of the team project collection, and replace MappingFile with the path and name of your custom mapping file. Specify /force if you are updating the existing mappings.
Wait until the following messages appear:
UploadingMappingFileto Team Project CollectiontpcUrl.
You have successfully uploaded field mapping fileMappingFileto Team Project CollectiontpcUrl.
Back to top
Customize the Project Server Tab
When you associate an enterprise project plan with a team project, the Project Server tab is added to the work item form, as the following illustration shows. The tab is added to only those types of work items that you specify to participate in data synchronization. You customize this tab by setting the displayTfsField or displayTfsMirror attributes to true for those fields that you want to have appear on the form.
Project Server tab
Important
The field mappings that are defined for the team project collection determine the fields that appear on the Project Server tab. After this tab has been added to a work item type for a team project, you can update it by modifying the field mappings for the collection. If you manually customize the work item form by adding fields to the Project Server tab or changing its location on the form, the tab may not get automatically updated with future changes that you make to the field mappings. If this condition occurs, you can modify the tab manually. For more information, see XML Elements Added to the Definition for the Work Item Type.
For more information about each default field that appears on the Project Server tab, see Project Server Fields Added to Support Data Synchronization.
Back to top
See Also
Tasks
Configure the Integration of Team Foundation Server and Project Server
Concepts
Specify the Work Item Types That Can Be Synchronized
Administrate the Integration of Team Foundation Server and Project Server