---
schema_version: "1"
id: 860f97e7b4e8f64174d1406edd370d89521e9d793c16085cdc81bc58c3496c08
title: NamedFilter
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/namedfilter.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/namedfilter.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 34e8cc6277395d0a97d5c03d28675f945a21dd4887de237e54e1b15765729359
description: 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.
---
# 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](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/metadata.htm "The base class for all metadata types. You can’t edit this object. A component is an instance of a metadata type.") 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](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note.png)

#### 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](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/customobject.htm "Represents a custom object that stores data unique to your org or an external object that maps to data stored outside your org.") for more information.

![Note](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note.png)

#### Note

Retrieving a component of this metadata type in a project makes the component appear in any Profile and PermissionSet components that are retrieved in the same package.

## 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.

<table class="featureTable sort_table" summary="">



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d1041301e109">Field Name</th>

              <th class="featureTableHeader  " id="d1041301e112">Field Type</th>

              <th class="featureTableHeader  " id="d1041301e115">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d1041301e109" data-title="Field Name"><span class="keyword parmname">active</span></td>

              <td class="entry" headers="d1041301e112" data-title="Field Type">boolean</td>

              <td class="entry" headers="d1041301e115" data-title="Description">Required. Indicates whether the lookup filter is active.</td>

            </tr>

            <tr>
              <td class="entry" headers="d1041301e109" data-title="Field Name"><span class="keyword parmname">booleanFilter</span></td>

              <td class="entry" headers="d1041301e112" data-title="Field Type">string</td>

              <td class="entry" headers="d1041301e115" data-title="Description">Specifies advanced filter conditions.</td>

            </tr>

            <tr>
              <td class="entry" headers="d1041301e109" data-title="Field Name"><span class="keyword parmname">description</span></td>

              <td class="entry" headers="d1041301e112" data-title="Field Type">string</td>

              <td class="entry" headers="d1041301e115" data-title="Description">A description of what this filter does.</td>

            </tr>

            <tr>
              <td class="entry" headers="d1041301e109" data-title="Field Name"><span class="keyword parmname">errorMessage</span></td>

              <td class="entry" headers="d1041301e112" data-title="Field Type">string</td>

              <td class="entry" headers="d1041301e115" data-title="Description"><span class="ph" id="errormsg"><a name="errormsg"><!-- --></a>The error message that appears if the lookup
                  filter fails.</span></td>

            </tr>

            <tr>
              <td class="entry" headers="d1041301e109" data-title="Field Name"><span class="keyword parmname" id="field"><a name="field"><!-- --></a>field</span></td>

              <td class="entry" headers="d1041301e112" data-title="Field Type">string</td>

              <td class="entry" headers="d1041301e115" data-title="Description">Required. The <span class="keyword parmname">fullName</span> of the custom or
                standard field associated with the lookup filter. You can associate
                one relationship field with each lookup filter, and vice
                versa.<div class="box message info">
                  <div class="inner">
                    <div class="bd">
                      <div class="media">
                        <img class="img mtm" src="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note.png" alt="Note">
                        <div class="mediaBd">
                          <h4 class="mbs">Note</h4>
                          <p>You can’t update a field associated with a lookup
                            filter.</p>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1041301e109" data-title="Field Name"><span class="keyword parmname">filterItems</span></td>

              <td class="entry" headers="d1041301e112" data-title="Field Type"><a class="xref" href="#filteritems">FilterItems[]</a></td>

              <td class="entry" headers="d1041301e115" data-title="Description">Required. The set of filter conditions.</td>

            </tr>

            <tr>
              <td class="entry" headers="d1041301e109" data-title="Field Name"><span class="keyword parmname">infoMessage</span></td>

              <td class="entry" headers="d1041301e112" data-title="Field Type">string</td>

              <td class="entry" headers="d1041301e115" data-title="Description"><span class="ph" id="infomsg"><a name="infomsg"><!-- --></a>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.</span></td>

            </tr>

            <tr>
              <td class="entry" headers="d1041301e109" data-title="Field Name"><span class="keyword parmname" id="field_fullName"><a name="field_fullName"><!-- --></a>fullName</span></td>

              <td class="entry" headers="d1041301e112" data-title="Field Type">string</td>

              <td class="entry" headers="d1041301e115" data-title="Description">Inherited from <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/metadata.htm" title="The base class for all metadata types. You can’t edit this object. A component is an instance of a metadata type.">Metadata</a>, this field is defined in the WSDL for this
                metadata type. It must be specified when creating, updating, or
                deleting. See <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_createMetadata.htm" title="Adds one or more new metadata components to your organization synchronously."><samp class="codeph java">createMetadata()</samp></a>
                to see an example of this field specified for a call.<p class="p" id="no_null_para"><a name="no_null_para"><!-- --></a>This value can’t be <samp class="codeph java">null</samp>.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d1041301e109" data-title="Field Name"><span class="keyword parmname">isOptional</span></td>

              <td class="entry" headers="d1041301e112" data-title="Field Type">boolean</td>

              <td class="entry" headers="d1041301e115" data-title="Description">Required. Indicates whether the lookup filter is
                optional.</td>

            </tr>

            <tr>
              <td class="entry" headers="d1041301e109" data-title="Field Name"><span class="keyword parmname">name</span></td>

              <td class="entry" headers="d1041301e112" data-title="Field Type">string</td>

              <td class="entry" headers="d1041301e115" data-title="Description"><span class="ph" id="lookupname"><a name="lookupname"><!-- --></a>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 <span class="keyword parmname">name</span>
                  field.</span></td>

            </tr>

            <tr>
              <td class="entry" headers="d1041301e109" data-title="Field Name"><span class="keyword parmname">sourceObject</span></td>

              <td class="entry" headers="d1041301e112" data-title="Field Type">string</td>

              <td class="entry" headers="d1041301e115" data-title="Description">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.</td>

            </tr>

          </tbody>

        </table>

Lookup filters use additional data types. For more information, see [Metadata Field Types](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_field_types.htm "These field types extend the field types described in the Salesforce Object Reference.").

## 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](#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

<?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\>

## 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](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/file_based_zip_file.htm "The deploy() and retrieve() calls are used to deploy and retrieve a .zip file. Within the .zip file is a project manifest (package.xml) that lists what to retrieve or deploy, and one or more XML components that are organized into folders.").

- [← Previous](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_marketingobject.htm "MarketingObject")
- [Next →](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_picklist.htm "Picklist (Including Dependent Picklist)")

#### See Also

- [CustomObject](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/customobject.htm "Represents a custom object that stores data unique to your org or an external object that maps to data stored outside your org.")
- [Picklist (Including Dependent Picklist)](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_picklist.htm "Deprecated. Represents a picklist (or dependent picklist) definition for a custom field in a custom object or a custom or standard field in a standard object, such as an account.")
- [Metadata](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/metadata.htm "The base class for all metadata types. You can’t edit this object. A component is an instance of a metadata type.")
- [CustomField](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/customfield.htm "Represents the metadata associated with a field. Use this metadata type to create, update, or delete custom field definitions on standard, custom, and external objects or standard field definitions on standard objects.")