0
votes

I am completely new to the salesforce type of development so please bear with me. As the title says I am trying to figure out how to undeploy/cleanup the target environment. Using the ant script I was able to pull down everything from a dev environment and deployed it successfully to a test environment. However, I also want to have the ability to cleanup this test environment before doing any additional deployments. Following the documentation I created an empty package.xml and a desctructiveChanges.xml file. However unlike the retrieval and deployment process I am unable to get this to work using wildcards. I am able to undeploy objects, pages, apex code if I explicitly reference it in the xml file but using * simply fails. Is it possible to do this or should I explore alternatives? Please keep in mind that deployment is of unpack-aged code.

sample from package.xml for deployment (succeeds)

<type>
<members>*</members>
<names>CustomObject</names>
</type>

sample from desctructiveChanges.xml (fails)

<type>
<members>*</members>
<names>CustomObject</names>
</type>
1

1 Answers

1
votes

destructiveChanges.xml requires a strict list of components which should be removed from a target environment. Thus you need to describe all components which should be removed in the following manner:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>ApexClass1</members>
        <members>ApexClass2</members>
        <members>ApexClass3</members>
        <name>ApexClass</name>
    </types>
    <types>
        <members>Custom_Object1__c</members>
        <members>Custom_Object2__c</members>
        <name>ApexPage</name>
    </types>
    <types>
        <members>VisualForcePage1</members>
        <members>VisualForcePage2</members>
        <name>CustomObject</name>
    </types>
    <types>
        <members>Custom_Object3__c.Field1__c</members>
        <members>Custom_Object3__c.Field2__c</members>
        <members>Custom_Object4__c.Field1__c</members>
        <name>CustomField</name>
    </types>
    <types>
        <members>CustomLabelName1</members>
        <name>CustomLabel</name>
    </types>
     <types>
        <members>Custom_Object3__c.Validation_Rule_1_Name</members>
        <name>ValidationRule</name>
    </types>
    <version>29.0</version>
</Package>