3

Salesforce now allows users to define List Views for Classes, Pages, etc. But I can't figure out how to deploy these to other orgs! Typically, list views are deployed as part of the CustomObject metadata type, but classes and pages aren't Objects. Is there a way to do this?

2

I don't believe you can do this.

Apex Classes and Pages are two files in the metadata, the .cls or .page file for source code and a *-meta.xml file containing the API version number and status.

There is no container into which such a list view definition could be put (unlike a CustomObject).

1

List Views can be deployed separately. Please check out the metadata documentation.

Sample XML looks like:

<?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>
3
  • And this also applies to Pages and Classes, which aren't CustomObjects? – Benj Feb 7 '13 at 20:19
  • I have not tested it myself, but I would assume so as long as you provide the proper fullName which should go to a specific API name. – Jesse Altman Feb 7 '13 at 20:20
  • @Benj my understanding is this only works for custom objects and I believe custom settings, most of the setup area config remains largely absent from the metadata api – Ralph Callaway Feb 15 '13 at 1:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.