Delen via


Expand list items and exclude groups from lists

You can expand and filter lists by using the expanditems and filteritems attributes. You can apply these attributes to these list type elements: ALLOWEDVALUES, SUGGESTEDVALUES, and PROHIBITEDVALUES.

To better understand how these attributes are used to populate a field's drop-down menu, review the examples provided below.

Expand lists and groups

You can assign the values true and false to expanditems; its value is true by default. When expanditems has the value of true, list items that represent groups or global lists are expanded recursively. A group's subgroups are expanded; the subgroups of those subgroups are also expanded, and continues in this pattern. After expansion, list items that represented groups include both groups and users as list item values. If expanditems is set to false, no group or global list expansion is performed.

Exclude groups

You can assign only the value excludegroups to the filteritems attribute. When this attribute appears, all the list items are evaluated and any groups are removed. Use the filteritems attribute to show only users, not groups.

Contents of lists and groups used in the examples

The examples provided in this topic use the following values:

List or group name

List or group contents

Description

[Project]\Business Analysts

JayHamlin

PilarAckerman

ReshmaPatel

A team project group that contains the names of three business analyst team members.

Note

Use the literal prefix [Project] instead of using the actual name of the team project.

Example1\MyTeam

Development

devuser

Test

Test user

Program Management

pmuser

juser

A team project group that contains one team member, juser, and three subgroups, where each subgroup contains the name of one team member.

Example1\MyReports

Userone

Usertwo

Userthree

MyRemotes

userfour

userfive

A team project group that contains the names of three team members and one subgroup which contains the names of two team members.

BoolValues

true

false

A global list with two entries.

Example: Expand lists and exclude groups

In this example, the field contains a string value, a group, and a global list. At the time it is run, the list is expanded and groups are excluded.

Example

Drop-down list values

<ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
   <LISTITEM value="string" />
   <LISTITEM value="[Project]\Business Analysts" />
   <GLOBALLIST name="BoolValues" />
</ALLOWEDVALUES>

string

true

false

JayHamlin

PilarAckerman

ReshmaPatel

Example: Expand lists and groups and do not filter

In this example, the field contains a string value, two groups, and a global list. At the time it is run the list is expanded and groups are not excluded.

Example

Drop-down list values

<ALLOWEDVALUES expanditems="true">
   <LISTITEM value="string" />
   <LISTITEM value="Example1\MyReports"/>
   <LISTITEM value="Example1\MyTeam" />
   <GLOBALLIST name="BoolValues" />
</ALLOWEDVALUES> 

string

true

false

juser

juser2

devuser

testuser

pmuser

Development

Test

Program Management

Example: Do not expand lists or groups, and do not filter

In this example, the field contains a string value, two groups, and a global list. At run time, the list is not expanded and groups are not filtered out. This means that group names are displayed, but not the users within those groups.

Note

The global list name and contents are not displayed.

Example

Drop-down list values

<ALLOWEDVALUES expanditems="false">
   <LISTITEM value="string" />
   <LISTITEM value="Example1\MyReports"/>
   <LISTITEM value="Example1\MyTeam" />
   <GLOBALLIST name="BoolValues" />
</ALLOWEDVALUES> 

string

MyTeam

MyReports

Example: Expand lists and exclude groups and global lists

In this example, the field contains a string value, one group, and a global list. At run time, the list is expanded and groups are filtered out.

Note

MyTeam is a group that is excluded and not expanded, and BoolValues is a global list, so neither one is expanded or shown.

Example

Drop-down list values

<ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
   <LISTITEM value="string" />
   <LISTITEM value="Example\MyTeam" />
   <GLOBALLIST name="BoolValues" />
</ALLOWEDVALUES> 

String

See Also

Concepts

Define pick lists

Define global lists

Other Resources

Apply a rule to a work item field