---
schema_version: "1"
id: 2e90e16cddc2cdf84f9e330690d0bf9a1cb53b4efd5e9431bd3b02c40a49e6d8
title: ListView
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_listview.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_listview.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 141519c82a3f5c487cd7a01da4074aad91652612912d83109bfd16a7aedb57e1
description: ListView allows you to see a filtered list of records, such as contacts, accounts, or custom objects.
---
# ListView

ListView allows you to see a filtered list of records, such as contacts, accounts, or custom objects.

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. See “Create a Custom List View in Salesforce Classic” in Salesforce Help.

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

#### Note

List views with the Visible only to me Restrict Visibility option aren’t accessible in Metadata API. Each of these list views is associated with a particular user.

## Declarative Metadata File Suffix and Directory Location

List views are stored within a CustomObject component. The component can represent a custom object or a standard object, such as an account.

## Version

ListView components for custom objects are available in API version 14.0 and later. ListView components for standard objects, such as accounts, are available in API version 17.0 and later.

## Fields

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



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

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

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

            </tr>

          </thead>

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

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

              <td class="entry" headers="d632551e107" data-title="Description">This field represents an Advanced Option for a filter. Advanced
                Options in filters allow you to build up filtering conditions that
                use a mixture of AND and OR boolean operators across multiple filter
                line items. For example, <samp class="codeph nolang">(1 AND 2) OR
                  3</samp> finds records that match both the first two filter
                line items or the third.</td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e101" data-title="Field"><span class="keyword parmname">columns</span></td>

              <td class="entry" headers="d632551e104" data-title="Field Type">string[]</td>

              <td class="entry" headers="d632551e107" data-title="Description"> The list of fields in the list view. The field name relative to
                the object name, for example MyCustomField__c, is specified for each
                custom field.
                <p class="p">Field names in the ListView columns don’t always
                  match their API name counterparts. If person accounts are
                  enabled in your organization, standard fields merged from a
                  contact into an account start with the <span class="keyword parmname">PC_</span>
                  prefix, while the corresponding API name starts with the
                  <span class="keyword parmname">Person</span> prefix. For example, the
                  ListView column name is <span class="keyword parmname">PC_Email</span> for a
                  corresponding API field name of
                  <span class="keyword parmname">PersonEmail</span>.
                </p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e101" data-title="Field"><span class="keyword parmname" id="field_division"><a name="field_division"><!-- --></a>division</span></td>

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

              <td class="entry" headers="d632551e107" data-title="Description">
                <span class="ph" id="field_division_desc"><a name="field_division_desc"><!-- --></a>If your organization uses divisions
                  to segment data and you’ve got the “Affected by
                  Divisions” permission, records in the list view must
                  match this division. This field is only available if you’re
                  searching all records.</span>
                <p class="p">This field is available in API
                  version 17.0 and later.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e101" data-title="Field"><span class="keyword parmname" id="field_filterScope"><a name="field_filterScope"><!-- --></a>filterScope</span></td>

              <td class="entry" headers="d632551e104" data-title="Field Type">
                <a class="xref" href="#filterScope">FilterScope</a> (<a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_objects_intro.htm#enumeration_title">enumeration</a> of type string)
              </td>

              <td class="entry" headers="d632551e107" data-title="Description">Required. This field indicates whether you’re filtering by owner
                or viewing all records.</td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e101" data-title="Field"><span class="keyword parmname">filters</span></td>

              <td class="entry" headers="d632551e104" data-title="Field Type">
                <a class="xref" href="#listViewFilter">ListViewFilter</a>[]
              </td>

              <td class="entry" headers="d632551e107" data-title="Description">The list of filter line items.</td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e101" data-title="Field"><span class="keyword parmname">fullName</span></td>

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

              <td class="entry" headers="d632551e107" data-title="Description">Required. Inherited from Metadata <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/customobject.htm" title="Represents a custom object that stores data unique to your org or an external object that maps to data stored outside your org.">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.</td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e101" data-title="Field"><span class="keyword parmname">label</span></td>

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

              <td class="entry" headers="d632551e107" data-title="Description">Required. The list view name.</td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e101" data-title="Field"><span class="keyword parmname" id="field_language"><a name="field_language"><!-- --></a>language</span></td>

              <td class="entry" headers="d632551e104" data-title="Field Type"><a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_translations.htm#translation_languages">Language</a></td>

              <td class="entry" headers="d632551e107" data-title="Description">
                <span class="ph" id="field_language_desc"><a name="field_language_desc"><!-- --></a>The language used for filtering if
                  your organization uses the Translation Workbench and you’re
                  using the <samp class="codeph soql">startsWith</samp> or
                  <samp class="codeph soql">contains</samp> operator. The
                  values entered as search terms must be in the same language as
                  the filter language.</span>
                <p class="p">For a list of valid language values,
                  see <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_translations.htm" title="Metadata type that enables work with translations for various supported languages. The ability to translate component labels is part of the Translation Workbench.">Language</a>.</p>
                <p class="p">This field is available in API
                  version 17.0 and later.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e101" data-title="Field"><span class="keyword parmname">queue</span></td>

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

              <td class="entry" headers="d632551e107" data-title="Description">The name of a queue. Objects are sometimes assigned to a queue so
                that the users who have access to the queue can monitor and manage
                them. When you create a queue, a corresponding list view is
                automatically created. See “Create Queues” in
                Salesforce Help.</td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e101" data-title="Field"><span class="keyword parmname" id="field_sharedTo"><a name="field_sharedTo"><!-- --></a>sharedTo</span></td>

              <td class="entry" headers="d632551e104" data-title="Field Type"><a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_sharedto.htm" title="SharedTo defines the sharing access for a list view or a folder. It can be used to specify the target and source for owner-based sharing rules.">SharedTo</a></td>

              <td class="entry" headers="d632551e107" data-title="Description">
                <span class="ph" id="field_sharedTo_desc"><a name="field_sharedTo_desc"><!-- --></a>Sharing access for the list
                  view.</span>
                <p class="p">This field is available in API version 17.0 and
                  later.</p>
              </td>

            </tr>

          </tbody>

        </table>

## ListViewFilter

ListViewFilter represents a filter line item.

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



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

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

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

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d632551e349" data-title="Field"><span class="keyword parmname">filter</span></td>

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

              <td class="entry" headers="d632551e355" data-title="Description">Required. Represents the field specified in the filter.</td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e349" data-title="Field"><span class="keyword parmname">operation</span></td>

              <td class="entry" headers="d632551e352" data-title="Field Type">FilterOperation (<a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_objects_intro.htm#enumeration_title">enumeration</a> of type string)</td>

              <td class="entry" headers="d632551e355" data-title="Description">Required. The operation used by the filter, such as <samp class="codeph java">equals</samp>. The valid values are:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph soql">equals</samp></li>

                  <li class="li"><samp class="codeph soql">notEqual</samp></li>

                  <li class="li"><samp class="codeph soql">lessThan</samp></li>

                  <li class="li"><samp class="codeph soql">greaterThan</samp></li>

                  <li class="li"><samp class="codeph soql">lessOrEqual</samp></li>

                  <li class="li"><samp class="codeph soql">greaterOrEqual</samp></li>

                  <li class="li"><samp class="codeph soql">contains</samp></li>

                  <li class="li"><samp class="codeph soql">notContain</samp></li>

                  <li class="li"><samp class="codeph soql">startsWith</samp></li>

                  <li class="li"><samp class="codeph soql">includes</samp></li>

                  <li class="li"><samp class="codeph soql">excludes</samp></li>

                  <li class="li">
                    <samp class="codeph soql">within</samp> (<samp class="codeph nolang">DISTANCE</samp> criteria
                    only)
                  </li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e349" data-title="Field"><span class="keyword parmname">value</span></td>

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

              <td class="entry" headers="d632551e355" data-title="Description">Represents the value of the filter item being operated upon, for
                example, if the filter is <samp class="codeph nolang">my_number_field__c &gt; 1</samp>, the value of <samp class="codeph nolang">value</samp> is <samp class="codeph nolang">1</samp>.</td>

            </tr>

          </tbody>

        </table>

## FilterScope

The FilterScope is an enumeration of type string that represents the filtering criteria for the records. The valid values are listed in the table:

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


          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d632551e497">Enumeration Value</th>

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

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d632551e497" data-title="Enumeration Value"><span class="keyword parmname">Everything</span></td>

              <td class="entry" headers="d632551e500" data-title="Description">All records, for example All Opportunities.</td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e497" data-title="Enumeration Value"><span class="keyword parmname">Mine</span></td>

              <td class="entry" headers="d632551e500" data-title="Description">Records owned by the user running the list view, for example My
                Opportunities.</td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e497" data-title="Enumeration Value"><span class="keyword parmname">MineAndMyGroups</span></td>

              <td class="entry" headers="d632551e500" data-title="Description">Records owned by the user running the list view, and records
                assigned to the user’s queues.</td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e497" data-title="Enumeration Value"><span class="keyword parmname">AssignedToMe</span></td>

              <td class="entry" headers="d632551e500" data-title="Description">Records assigned to the user running the list view.<p class="p">The <samp class="codeph nolang">AssignedToMe</samp> scope is supported
                  for the ServiceAppointment object only.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e497" data-title="Enumeration Value"><span class="keyword parmname">Queue</span></td>

              <td class="entry" headers="d632551e500" data-title="Description">Records assigned to a queue.</td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e497" data-title="Enumeration Value"><span class="keyword parmname" id="option_Delegated"><a name="option_Delegated"><!-- --></a>Delegated</span></td>

              <td class="entry" headers="d632551e500" data-title="Description">Records delegated to another user for action: for example, a
                delegated task. This option is available in API version 17.0 and
                later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e497" data-title="Enumeration Value"><span class="keyword parmname" id="option_MyTerritory"><a name="option_MyTerritory"><!-- --></a>MyTerritory</span></td>

              <td class="entry" headers="d632551e500" data-title="Description">Records in the territory of the user seeing the list view. <span class="ph" id="option_territory_mgmt"><a name="option_territory_mgmt"><!-- --></a>This option is available if territory
                  management is enabled for your organization.</span> Opportunities
                can’t be filtered by <samp class="codeph nolang">MyTerritory</samp>. This option is available in API version
                17.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e497" data-title="Enumeration Value"><span class="keyword parmname" id="option_MyTeamTerritory"><a name="option_MyTeamTerritory"><!-- --></a>MyTeamTerritory</span></td>

              <td class="entry" headers="d632551e500" data-title="Description">Records in the territory of the team of the user seeing the list
                view. <samp class="codeph nolang">This option is available if territory
                  management is enabled for your organization.MyTeamTerritory</samp>. This option is available in API
                version 17.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e497" data-title="Enumeration Value"><span class="keyword parmname" id="option_Team"><a name="option_Team"><!-- --></a>Team</span></td>

              <td class="entry" headers="d632551e500" data-title="Description">Records assigned to a team. In the Lightning Experience UI, the
                corresponding list view filter is <strong class="ph uicontrol">My team’s
                  opportunities</strong>. This option is available in API
                version 17.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e497" data-title="Enumeration Value"><span class="keyword parmname">SalesTeam</span></td>

              <td class="entry" headers="d632551e500" data-title="Description">Opportunities assigned to an opportunity team. In the Lightning
                Experience UI, the corresponding list view filter is <strong class="ph uicontrol">My
                  opportunity teams</strong>. This option is available in API
                version 49.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d632551e497" data-title="Enumeration Value"><span class="keyword parmname">ScopingRule</span></td>

              <td class="entry" headers="d632551e500" data-title="Description">Records that meet a scoping rule's record criteria. In Lightning
                Experience, scoping rules are applied to list views only if the user
                selects <strong class="ph uicontrol">Filter by scope</strong>.</td>

            </tr>

          </tbody>

        </table>

## Declarative Metadata Sample Definition

A sample XML definition of a list view in a custom object is shown.

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
. . .
    <listViews\>
        <fullName\>All\_Mileages</fullName\>
        <filterScope\>everything</filterScope\>
        <label\>All Mileages</label\>
    </listViews\>
    <listViews\>
        <fullName\>My\_Mileages</fullName\>
        <booleanFilter\>1 AND 2</booleanFilter\>
        <columns\>NAME</columns\>
        <columns\>CREATED\_DATE</columns\>
        <filterScope\>mine</filterScope\>
        <filters\>
            <field\>NAME</field\>
            <operation\>equals</operation\>
            <value\>Eric Bristow</value\>
        </filters\>
        <filters\>
            <field\>City\_\_c</field\>
            <operation\>equals</operation\>
            <value\>Paris</value\>
        </filters\>
        <label\>My Mileages</label\>
    </listViews\>
. . .
</CustomObject\>

## Usage

In general, avoid including unedited default list views in managed packages. We discourage including a modified default list view in a managed package, as it can result in duplicated list views in the target org. See [Incorrect List View Loads Due to Possibility of Existing Duplicate List Views](https://help.salesforce.com/s/articleView?id=000386164&type=1&language=en_US).

Metadata API retrieve doesn't return standard list views for some objects, including Task and Event, because they already exist on all targets. After you've modified a standard list view from its original content, you can retrieve and deploy it. Standard list views on other objects, such as Account, are retrievable. To customize a standard list view, create a custom list view.

## 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.264.0.api_meta.meta/api_meta/file_based_zip_file.htm).

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

#### 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.")
- [Sample package.xml Manifest Files](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/manifest_samples.htm "This section includes sample package.xml manifest files that show you how to work with different subsets of metadata. A manifest file can include multiple <types> elements so you could combine the individual samples into one package.xml manifest file if you want to work with all the metadata in one batch.")