ListView

ListView allows you to see a filtered list of records such as contacts, accounts, or custom objects. It extends the Metadata metadata type and inherits its fullName field. See “Creating Custom List Views” in the Salesforce online help.

Note
List views with the Visible only to me Restrict Visibility option are not 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

Field Field Type Description
booleanFilter string 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, (1 AND 2) OR 3 finds records that match both the first two filter line items or the third. See “Getting the Most Out of Filter Logic” in the Salesforce online help.
columns string[] 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.
division string If your organization uses divisions to segment data and you have the “Affected by Divisions” permission, records in the list view must match this division. This field is only available if you are searching all records.

This field is available in API version 17.0 and later.

filterScope FilterScope (enumeration of type string) Required. This field indicates whether you are filtering by owner or viewing all records.
filters ListViewFilter[] The list of filter line items.
fullName string Required. 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.
label string Required. The list view name.
language Language The language used for filtering if your organization uses the Translation Workbench and you are using the startsWith or contains operator. The values entered as search terms must be in the same language as the filter language. See “Enter Filter Criteria” in the Salesforce online help.

For a list of valid language values, see Language.

This field is available in API version 17.0 and later.

queue string 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 “Creating Queues” in the Salesforce online help.
sharedTo SharedTo Sharing access for the list view.

This field is available in API version 17.0 and later.

ListViewFilter

ListViewFilter represents a filter line item.

Field Field Type Description
filter string Required. Represents the field specified in the filter.
operation FilterOperation (enumeration of type string) Required. The operation used by the filter, such as equals. The valid values are listed 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.

FilterScope

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

Enumeration Value Description
Everything All records, for example All Opportunities.
Mine Records owned by the user running the list view, for example My Opportunities.
Queue Records assigned to a queue.
Delegated Records delegated to another user for action: for example, a delegated task. This option is available in API version 17.0 and later.
MyTerritory Records in the territory of the user seeing the list view. This option is available if territory management is enabled for your organization. This option is available in API version 17.0 and later.
MyTeamTerritory Records in the territory of the team of the user seeing the list view. This option is available if territory management is enabled for your organization. This option is available in API version 17.0 and later.
Team Records assigned to a team. This option is available in API version 17.0 and later.

Declarative Metadata Sample Definition

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

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
. . .
    <listViews>
        <fullName>All_Mileages</fullName>
        <filterScope>all</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>
© Copyright 2000–2014 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.