Newer Version Available
NamedFilter
Declarative Metadata File Suffix and Directory Location
Lookup filters are defined as part of the custom object or standard object definition. See CustomObject for more information.
Version
Lookup filters are available in API version 17.0 and later. However, the NamedFilter type was removed in API version 30.0. The metadata associated with a lookup filter is now represented by the lookupFilter field in the CustomField type.
Fields
Unless otherwise noted, all fields are creatable, filterable, and nillable.
| Field Name | Field Type | Description |
|---|---|---|
| active | boolean | Required. Indicates whether the lookup filter is active. |
| booleanFilter | string | Specifies advanced filter conditions. |
| description | string | A description of what this filter does. |
| errorMessage | string | The error message that appears if the lookup filter fails. |
| field | string | Required. The fullName of the custom or standard field associated with the lookup filter. You can associate one relationship field with each lookup filter, and vice versa. |
| filterItems | FilterItems[] | Required. The set of filter conditions. |
| infoMessage | string | The information message displayed on the page. Use to describe things the user might not understand, such as why certain items are excluded in the lookup filter. |
| fullName | string | Inherited from Metadata, this field is defined in the WSDL for this metadata type. It must be specified when creating, updating, or deleting. See createMetadata() to see an example of this field specified for a call. |
| isOptional | boolean | Required. Indicates whether the lookup filter is optional. |
| name | string | Required. The name of the lookup filter. If you create this field in the user interface, a name is automatically assigned. If you create this field through Metadata API, you must include the name field. |
| sourceObject | string | The object that contains the lookup field that uses this lookup filter. Set this field if the lookup filter references fields on the source object. |
Lookup filters use additional data types. For more information, see Metadata Field Types.
FilterItems
FilterItems contains the following properties:
| Field | Field Type | Description |
|---|---|---|
| field | string | Represents the field specified in the filter. |
| operation | FilterOperation (enumeration of type string) | Represents the filter operation for this filter item. Valid values are enumerated in FilterOperation. |
| value | string | Represents the value of the filter item being operated upon, for example, if the filter is my_number_field__c > 1, the value of value is 1. |
FilterOperation
Here’s an enumeration of type string that lists different filter operations. Valid values are:
- equals
- notEqual
- lessThan
- greaterThan
- lessOrEqual
- greaterOrEqual
- contains
- notContain
- startsWith
- includes
- excludes
Declarative Metadata Sample Definition
1<?xml version="1.0" encoding="UTF-8"?>
2<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
3....
4 <namedfilters>
5 <fullName>nf_Acc</fullName>
6 <active>true</active>
7 <booleanFilter>1 OR 2</booleanFilter>
8 <field>Account.lk__c</field>
9 <filterItems>
10 <field>Account.Phone</field>
11 <operation>notEqual</operation>
12 <value>x</value>
13 </filterItems>
14 <filterItems>
15 <field>Account.Fax</field>
16 <operation>notEqual</operation>
17 <value>y</value>
18 </filterItems>
19 <name>Acc</name>
20 <sourceObject>Account</sourceObject>
21 </namedfilters>
22....
23</CustomObject>Wildcard Support in the Manifest File
This metadata type doesn’t support the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.