ListView

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

See “Create a Custom List View in Salesforce Classic” in Salesforce Help.

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.

This type extends Metadata and inherits its fields.

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

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.

  • Type: string
  • Required: No
  • 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, (1 AND 2) OR 3 finds records that match both the first two filter line items or the third.
  • Type: string[]

  • Required: No

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

    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 PC_ prefix, while the corresponding API name starts with the Person prefix. For example, the ListView column name is PC_Email for a corresponding API field name of PersonEmail.

  • Type: string
  • Required: No
  • Introduced: API version 17.0
  • Description: 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.
  • Type: ListViewFilter[]
  • Required: No
  • Description: The list of filter line items.
  • Type: string
  • Required: No
  • Description: Required. Inherited from Metadata Metadata, this field is defined in the WSDL for this metadata type. It must be specified when creating, updating, or deleting. See createMetadata() to see an example of this field specified for a call.
  • Type: string
  • Required: Yes
  • Description: Required. The list view name.
  • Type: Language (enumeration of type string)

  • Required: No

  • Introduced: API version 17.0

  • Description: The language used for filtering if your organization uses the Translation Workbench and you’re using the startsWith or contains operator. The values entered as search terms must be in the same language as the filter language.

    For a list of valid language values, see Language.

  • Type: string
  • Required: No
  • 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.
  • Type: SharedTo
  • Required: No
  • Introduced: API version 17.0
  • Description: Sharing access for the list view.

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

ListViewFilter represents a filter line item.

  • Type: string
  • Required: Yes
  • Type: string
  • Required: Yes
  • Description: Required. Represents the field specified in the filter.
  • Type: FilterOperation (enumeration of type string)
  • Required: Yes
  • Description: Required. The operation used by the filter, such as equals.
  • Possible values:
    • equals
    • notEqual
    • lessThan
    • greaterThan
    • lessOrEqual
    • greaterOrEqual
    • contains
    • notContain
    • startsWith
    • includes
    • excludes
    • within — (DISTANCE criteria only)
  • Type: string
  • Required: No
  • Description: 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.

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

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.

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.

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.