function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
The_London_ScottThe_London_Scott 

How to mass-delete list views?

I want to delete large numbers of obsolete list views as part of a clean-up.  Take Lead list views as an example.  I've pulled the Lead metadata into the Force.com IDE and tried deleting the definition of one of the list views (see below) and saving the src back to server.  But this does not delete the list view in question. What am I doing wrong?

 

<listViews>

        <fullName>ALE_Lead_View1</fullName>

        <columns>FULL_NAME</columns>

        <columns>LEAD.COMPANY</columns>

        <columns>LEAD.STATE</columns>

        <columns>LEAD.EMAIL</columns>

        <columns>LEAD.PHONE</columns>

        <columns>LEAD.STATUS</columns>

        <filterScope>Everything</filterScope>

        <filters>

            <field>Region__c</field>

            <operation>equals</operation>

            <value>NORTHAM</value>

        </filters>

        <label>ALE Lead View</label>

        <language>en_US</language>

        <sharedTo/>

</listViews>

sfdcfoxsfdcfox

You have to use a destructiveChanges.xml file; removing them from the package.xml doesn't delete them, it simply doesn't update them. This follows the same form as a normal SQL database (or even the rest of the Salesforce.com API). This sort of "explicit delete" requirement prevents humans from making silly mistakes in their files and removing a ton of fields, reports, etc that they didn't intend to.