|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
How to: Define a Rule Based on a Group
You can define a rule that applies to a specific security group for a work item type by exporting the XML file and modifying its content. Then you can import the XML file to start to use the updated work item type.
To perform this procedure, you must be a member of the Team Foundation Administrators group and a member of the Project Administrators group for the project. For more information, see Team Foundation Server Permissions.
To scope rules to groups
If you are modifying a work item type on a single project, run witexport to export the XML file for the work item type you want to modify. For more information, see How to: Export a Work Item Type from an Existing Project.
In Visual Studio, click File, click Open, and then click File.
This displays the Open File dialog box.
Under Look in, move to the location where you exported the file.
If you are modifying a work item type to customize a process template, move to the location where you downloaded the process template.
If you are running Windows Vista, you might not have access rights to certain folders. If you try to export the work item type to a location where you do not have access rights, the registry virtualization technology automatically redirects the exported file and saves it to the virtual store. For more information, see http://go.microsoft.com/fwlink/?LinkId=92325 and http://go.microsoft.com/fwlink/?LinkId=92323. To avoid this redirection, you can export the file to a location where you have access rights.
Select the work item type XML file that you want to update, and then click Open. When you are prompted about line endings, click No.
Find the <WORKFLOW> section of the XML file. Within this section are the following lines that describe the Active state.
<STATE value="Active"> <FIELDS> <FIELD refname="Microsoft.VSTS.Common.ClosedDate"> <EMPTY /> </FIELD> <FIELD refname="Microsoft.VSTS.Common.ClosedBy"> <EMPTY /> </FIELD> </FIELDS> </STATE>
Add the following XML to make the Assigned To field required for Project Administrators who edit this work item type in the Active state.
<STATE value="Active"> <FIELDS> <FIELD refname="System.AssignedTo"> <REQUIRED for="[Project]\Project Administrators" not="[Global]\Team Foundation Administrators" /> </FIELD> <FIELD refname="Microsoft.VSTS.Common.ClosedDate"> <EMPTY /> </FIELD> <FIELD refname="Microsoft.VSTS.Common.ClosedBy"> <EMPTY /> </FIELD> </FIELDS> </STATE>
The for and not attributes can be applied to many other rules. For more information, see Conditional Field Rule Attributes.
On the toolbar, click Save to save changes to the XML file.
To import the new work item type to a single project, see How to: Import a Work Item Type to an Existing Project. To add the work item type to your process template, see Work Item Types.
To verify changes imported to a single project
In Team Explorer, click Refresh to download the latest updates from the server.
These updates include the changes that you just imported. Wait several seconds until all the nodes are loaded. Nodes that are still loading are labeled working.
Create a new work item using your modified work item type. To do this, right-click the Work Items node, point to Add Work Item, and then click the work item type.
This work item is created from the work item type that you changed and imported.
Fill in the Title field and then click Save to save the work item.
An error displays stating that the Assigned To field contains an unsupported value.
Select the Assigned To field and delete its contents, and then click Save.
Set the State field to Active.
Notice that the Assigned To field is highlighted now because you are a member of the Project Administrators group.
Click Close to close the new work item. Click No when you are prompted to save the work item.