NamedFilter

Represents the metadata associated with a lookup filter. Use this metadata type to create, update, or delete lookup filter definitions. It 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.
Note
The namedFilter appears as a child of the target object of the associated lookup field.

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.

Note
Retrieving a component of this metadata type in a project makes the component appear in the Profile component as well.

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. For more information on advanced filter conditions, see “Filter Logic Tips” in the Salesforce online help.
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.
Note
You cannot update a field associated with a lookup filter.
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.

This value cannot be null.

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 the 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:

Declarative Metadata Sample Definition

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
....
    <namedfilters>
        <fullName>nf_Acc</fullName>
        <active>true</active>
        <booleanFilter>1 OR 2</booleanFilter>
        <field>Account.lk__c</field>
        <filterItems>
            <field>Account.Phone</field>
            <operation>notEqual</operation>
            <value>x</value>
        </filterItems>
        <filterItems>
            <field>Account.Fax</field>
            <operation>notEqual</operation>
            <value>y</value>
        </filterItems>
        <name>Acc</name>
        <sourceObject>Account</sourceObject>
    </namedfilters>
....
</CustomObject>
© Copyright 2000–2012 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.