Newer Version Available
NamedFilter
Represents the metadata associated with a lookup filter. This metadata
type
is used to create, update, or delete lookup filter definitions. This
component has been removed as of API version 30.0 and is only available in previous API
versions. The metadata associated with a lookup
filter is now represented by the lookupFilter field in the
CustomField
component.
This type extends the Metadata
metadata type and inherits its fullName field. You can also
use this metadata type to work with customizations of lookup filters on standard
fields.
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.
Fields
Unless otherwise noted, all fields are createable, filterable, and nillable.
| Field Name | Field Type | Description |
|---|---|---|
| active | boolean | Required. Indicates whether or not 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 not defined in the WSDL for this metadata type. It must be specified when creating, updating, or deleting. See create() to see an example of this field specified for a call. |
| isOptional | boolean | Required. Indicates whether or not 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
This is 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>