Azure Devops Server 2022 - Adding a pick-list of users to a work item type

65 views Asked by At

We are using on-prem Devops Server 2022. This is a system that has been regularly upgraded since first implemented as TFS 2010.

We wish to modify the "Feature" work item type to include a pick-list of users. This field will represent the "Business Owner" of the feature and it will be a reportable field.

However, there does not appear to be a way to add a field for picking a user without stepping on an existing field. For instance, there are these existing System fields:

  • System.AssignedTo
  • System.ChangedBy
  • System.CreatedBy

What I need is a generic system user list that I can assign to the field via pick list.

Any ideas on how to do this?

2

There are 2 answers

0
Novelli On BEST ANSWER

Yes, we have the XML process model due to the age of our system.

For the user pick list, I wanted the list of DevOps valid users, not a custom hard-coded list in the GlobalList.

After experimenting and breaking some things in my non-production Azure DevOps, I found what to do.

To start, the many resources online are good general references, but of little specific help for adding fields. I found no reference to the list and purpose of XML attributes for work item types.

After exporting the work item XML, I added a new field at the top using an existing user field as a pattern. The key is specifying a refname for the field. In my case, I simply used the collection name and the field name. For example: refname="DefaultCollection.BusinessOwner"

The complete field definition is:

<FIELD name="Business Owner" refname="DefaultCollction.BusinessOwner" type="String" syncnamechanges="true" reportable="dimension">
    <HELPTEXT>This is the Business Sponsor most responsible for success of the project.</HELPTEXT>
    <ALLOWEXISTINGVALUE />
    <VALIDUSER />
  </FIELD>

The attribute that allows using DevOps users for the picklist is <VALIDUSER />

I wanted this field to appear in web form with the Planning and Classification groups and to include a descriptive label. Down in the <WebLayout> section of the XML, I added a new Group block above the Planning and Classification group blocks:

<Group Label="Business Owner">
    <Control Type="LabelControl" Name="DefaultCollction.BusinessOwnerLabel" >
        <LabelText>
            <Text>Business Owner is the sponsor or resource planning designate for the project or feature.</Text>
        </LabelText>
    </Control>
    <Control Type="FieldControl" FieldName="DefaultCollction.BusinessOwner" />
</Group>

After importing the revised WIT XML, the new field appeared as I wanted it. And it's reportable - I can select this field in queries and backlogs.

Revised Feature Work Item with new Business User field

0
Andy Li-MSFT On

Per your description it appears that that you are using the On-premises XML process model (upgraded from TFS 2010).

What I need is a generic system user list that I can assign to the field via pick list.

You can try to create a global list file and add all Business Owner users into the list. Then use the global list in the Business Owner field definition. See Define global lists.

1.Create a new XML file named GlobalList.xml, open it in a text editor, and add the following:

<GLOBALLISTS>
 <GLOBALLIST  name="BusinessOwner">
  <LISTITEM value="UserName1" />
  <LISTITEM value="UserName2" />
  <LISTITEM value="UserName3" />
 </GLOBALLIST>
</GLOBALLISTS>

2.This Global List can be imported using the following command line (see witAdmin: Customize and manage objects for tracking work for details.):

Witadmin  importgloballist /collection:http://serverurl /f:GlobalList.xml

3.Once the Global List is successfully imported, we can modify the Feature WITD to use this Global List for the Business Owner field. In the field definition, change the ALLOWEDVALUES tag to the following:

 <ALLOWEDVALUES expanditems="true">
       <GLOBALLIST  name="BusinessOwner" />
 </ALLOWEDVALUES>