Adding the ability to filter records on an Entity List is easy - simply enable the filtering option and then choose one or more filter types to display to users. It is possible to filter by an attribute matching some text provided by the user, or to select from a series of options. You can even design virtually any type of filter you can imagine using Dynamics CRM's Advanced Find.

Enabling the Entity List Filter

In the Metadata Filter section, check the box labeled Enabled. This will add the filter area to the Entity List when it is displayed. Until you have defined at least one filter type, the box will appear empty.

You can define how the Filter area on the Entity List will rendered using the Orientation. The default, Horizontal, renders the Filter area above the Entity List. Vertical Orientation renders the Filter area as a box to the left of the Entity List.

Horizontal:

Vertical:

The "Apply" button in the Filter area can have its label overridden using the Apply Button Label setting. This allows you to specify any label you wish for each installed language pack in your CRM.

Filter Types

There are several types of filters that may be defined:

Filter TypeDescription
Text Filter Filter the Entity List using a textbox to search for matching text in a selected Attribute of the given Entity.
Attribute Filter Set Filter the Entity List using a series of checkboxes, each of which tries to match its condition against a particular Attribute of the given Entity.
Lookup Set Filter the Entity List using a series of checkboxes, each of which represents a Relationship between a Record for the given Entity and a Record for a related Entity.
Range Filter Set Similiar to the Attribute Filter Set, except that each checkbox can represent two conditions rather than one (e.g. "greater than or equal to 0 AND less than 100").
Dynamic Picklist Set Similar to choosing a Picklist value on an Attribute Filter Set. The Dynamic Picklist Set does not require that you specify the picklist options to filter by; instead, it generates the full list of options when the Entity List is loaded.
Dynamic Lookup Set Similar to the Lookup Set. The Dynamic Lookup Set does not require that you specify the lookup options to filter by; instead, it generates the full list of options when the Entity List is loaded.
FetchXML Filter Filter the Entity List using a FetchXML filter condition.

Text Filter

The Text Filter adds a textbox to the Entity List Filter area that is tied to an attribute of the Entity List's Entity Type. When a user applies the filter, the Entity List only displays those records whose selected attribute contains the value.

To add a Text Filter, click " Text Filter":

The Text Filter uses the following attributes:

NameDescription
Attribute

The name of the Attribute on the Entity List's selected Entity Type to filter by.

Only attributes with the type "String" are valid for a Text Filter.

Display Name

Override the label for the Filter when the Entity List is displayed. By default, this will be automatically set to the name of the selected Attribute.

Attribute Filter Set

The Attribute Filter Set adds a series of options to filter the Entity List by, tied to a single attribute of the Entity List's selected Entity Type. When a user applies the filter, the Entity List only displays those records that exactly match at least one of the selected options.

The Attribute Filter Set uses the following attributes:

NameDescription
Attribute

The name of the Attribute on the Entity List's selected Entity Type to filter by.

Only attributes with the following types are valid for a Text Filter:

  • String
  • BigInt
  • Decimal
  • Double
  • Integer
  • Money
  • Picklist
  • DateTime
  • Boolean
Display Name

Override the label for the Filter when the Entity List is displayed. By default, this will be automatically set to the name of the selected Attribute.

Options

A collection of possible values to filter by. See below for more details.

Attribute Filter Set Options

An Attribute Filter Set can usually have any number of options, with the exceptions of Picklist and Boolean attributes. A Boolean Attribute Filter Set can have only one or two options - one "true" option and one "false" option. A Picklist Attribute Filter Set can have at most one option for each possible value in the Picklist.

Options have the following attributes:

NameDescription
Operator

The comparison operator used to filter results, e.g. "Equals", "Less Than", etc. The list of Operators for the option will depend on the type of the Attribute selected for the Filter.

For example, numeric types ("Decimal") will have Operators such as "Less Than" or "Greater Than", whereas "String" attributes will use Operators such as "Begins With" or "Contains".

Picklist and Boolean operators are always "Equals".

Value The actual value used for this filter condition.
Display Name Overrides the display name for this Option in the Filter box. By default, this will be set to the same value as the Value attribute.

Lookup Set

The Lookup Set adds a series of options to filter the Entity List by, tied to a related entity to the Entity List's selected Entity Type. When a user applies the filter, the Entity List only displays those records that exactly match at least one of the selected related records.

The Lookup Set uses the following attributes:

NameDescription
Relationship

The name of the Related Entity to the Entity List's selected Entity Type to filter by.

Only entities with a one-to-many or many-to-many relationship with the Entity List's selected Entity Type appear as options for this filter type.

Display Name

Override the label for the Filter when the Entity List is displayed. By default, this will be automatically set to the name of the selected Relationship.

Options

A collection of poosible values to filter by. See below for more details.

Lookup Set Options

A Lookup Set can typically have any number of options, with the only limit being the number of related records of the selected related type.

Options have the following attributes:

NameDescription
Value The record of the selected related type to filter by.
Display Name Overrides the display name for this Option in the Filter box. By default, this will be set to the same value as the Value attribute.

Range Filter Set

The Range Filter Set adds a series of options, each with one or two conditions, to the Filter area. When a user applies the filter, the Entity List only displays those records that exactly matches all conditions on at least one of the selected options.

The Range Filter Set uses the following attributes:

NameDescription
Attribute

The name of the Attribute on the Entity List's selected Entity Type to filter by.

Only attributes with the following types are valid for a Text Filter:

  • String
  • BigInt
  • Decimal
  • Double
  • Integer
  • Money
  • DateTime
Display Name

Override the label for the Filter when the Entity List is displayed. By default, this will be automatically set to the name of the selected Attribute.

Options

A collection of poosible values to filter by. See below for more details.

Range Filter Set Options

A Range Filter Set can have any number of options. Each option will produce a filter condition with either one or two subconditions, both of which must be met for the condition to be true.

Options have the following attributes:

NameDescription
Operator 1

The first comparison operator used to filter results, e.g. "Equals", "Less Than", etc. The list of Operators for the option will depend on the type of the Attribute selected for the Filter.

For example, numeric types ("Decimal") will have Operators such as "Less Than" or "Greater Than", whereas "String" attributes will use Operators such as "Begins With" or "Contains".

Picklist and Boolean operators are always "Equals".

Value 1 The first value used for this filter condition.
Operator 2 (optional)

The second comparison operator used to filter results, e.g. "Equals", "Less Than", etc. The list of Operators for the option will depend on the type of the Attribute selected for the Filter.

For example, numeric types ("Decimal") will have Operators such as "Less Than" or "Greater Than", whereas "String" attributes will use Operators such as "Begins With" or "Contains".

Picklist and Boolean operators are always "Equals".

Value 2 (optional) The second value used for this filter condition.
Display Name Overrides the display name for this Option in the Filter box. By default, this will be set dynamically based on the operator(s) and value(s) selected.

Dynamic Picklist Set

The Dynamic Picklist Set adds a series of options to filter by that represent all the values of a specified Picklist field. This is different from selecting a Picklist in the Attribute Filter Set. In the Attribute Filter Set, you must specify a set of options that will be made available to the user to filter by; In the Dynamic Picklist Set you need only specify the Picklist field and the entire set of options will be provided automatically. If you need greater control, it is recommended to use the Attribute Filter Set.

The Dynamic Picklist Set uses the following options:

NameDescription
Attribute

The name of the Picklist Attribute on the Entity List's selected Entity Type to filter by.

Display Name

Override the label for the Filter when the Entity List is displayed. By default, this will be automatically set to the name of the selected Attribute.

Dynamic Lookup Set

The Dynamic Lookup Set adds a dynamic series of options to filter the Entity List by, tied to a related entity to the Entity List's selected Entity Type. When a user applies the filter, the Entity List only displays those records that exactly match at least one of the selected related records. 

This is different from a Lookup Set. In the Lookup Set, you must manually specify the related entities to filter by; In the Dynamic Lookup Set, you need only specify the relationship on which to filter, and a list of options will be generated based on the specified View of related entities.

The Dynamic Lookup Set uses the following options:

NameDescription
Relationship

The name of the Related Entity to the Entity List's selected Entity Type to filter by.

Only entities with a one-to-many or many-to-many relationship with the Entity List's selected Entity Type appear as options for this filter type.

View The View (savedquery) to use as a source for the dynamic list of entities to filter by
Label Column The field from the View that provides each entity's "Name" value.
Filter Lookup On Relationship

Specifies a relationship between the entity specified by the Relationship field and the logged in user.

If the entity specified by the Relationship field also has a relationship to a contact, you may optionally narrow the list of filter options to those related to the logged in user.

Display Name Override the label for the Filter when the Entity List is displayed. By default, this will be automatically set to the name of the selected Relationship.

FetchXML Filter

The range filter can create either a simple textbox filter like the Text Filter, or a set of options like the other filter types. It allows you to manually create virtually any type of filter for the Entity List using Microsoft's FetchXML query language.

The FetchXML Filter uses only one attribute:

NameDescription
FetchXML The XML statement representing the filter.

In addition to the default FetchXML elements and attributes, additional "adx" namespaced attributes are supported to control the appearance and behaviour of the resulting filter.

NameApplies to ElementDescription
adx:uiname

<filter>

<link-entity>

Overrides the display name for the element in the rendered filter.

This attribute typically applies to the top-level element, such as the root <filter> element. In the case of a many-to-many relationship, the adx:uiname attribute should be applied to the inner <link-entity> element.

<filter type="or" adx:uiname="Name">
<!-- conditions -->
</filter>

Note: For <condition> elements, you must use the built-in uiname attribute instead.

adx:uiinputtype

<condition>

For a textbox filter, apply this attribute to the <filter> element's first (and only) <condition> element with the value "text".

<condition attribute="name" operator="like" value="%%" adx:uiinputtype="text" />

Using Advanced Find to Build a FetchXML Filter

While it is possible to simply construct the FetchXML statement manually, for most users it will be simpler to use Dynamics CRM's built-in Advanced Find feature.

First, create the desired filter in the Advanced Find interface:

Once you have configured your desired filter, click Download Fetch XML:

Open the downloaded file in any text editor:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="product">
<attribute name="name" />
<attribute name="productnumber" />
<attribute name="subjectid" />
<attribute name="statecode" />
<attribute name="productid" />
<order attribute="productnumber" descending="false" />
<link-entity name="adx_brand" from="adx_brandid" to="adx_brand" alias="aa">
<filter type="and">
<filter type="or">
<condition attribute="adx_brandid" operator="eq" uiname="Bleau" uitype="adx_brand" value="{09E8C9E2-FF8F-E211-ABD2-00155D035A05}" />
<condition attribute="adx_brandid" operator="eq" uiname="Golde" uitype="adx_brand" value="{2CCA18EB-FF8F-E211-ABD2-00155D035A05}" />
<condition attribute="adx_brandid" operator="eq" uiname="Greene" uitype="adx_brand" value="{2ACA18EB-FF8F-E211-ABD2-00155D035A05}" />
<condition attribute="adx_brandid" operator="eq" uiname="Redline" uitype="adx_brand" value="{0BE8C9E2-FF8F-E211-ABD2-00155D035A05}" />
</filter>
</filter>
</link-entity>
</entity>
</fetch>

Next, copy the <filter> or <link-entity> element you wish to use as the filter, and paste it into the Entity List's FetchXML Filter editor. In some cases, you may need to remove extra <filter> elements (Advanced Find typically adds an "and" filter around all filter options - this element must be stripped out in order for the Filter to appear correctly in the Entity List).

In many cases, the FetchXML statement will work with no further modification. You may wish to add uiname or adx:uiname attributes to various elements, or edit existing uiname attributes.