0

I want to delete all the LWC components and Apexclasses using destructiveChanges.xml. I tried with

<types>
        <members>*</members>
        <name>LightningComponentBundle</name>
</types>
 destructiveChanges.xml -- Warning: No LightningComponentBundle named: * found

By googling I found out that wildcards are not supported in destructiveChanges.xml.

Is there any other way to delete the files in one shot through ANT?.

Sandbox refresh can help me on this issue but the thing is I have to delete the classes/LWC everyday through ANT.

4

You can use the listMetadata API calls to get a full list of elements, then parse it in to a destructiveChanges.xml and build your package. A simple NodeJS script can do this pretty easily, or even a shell script (zsh, bash, ash, etc).

You can also do this with Salesforce DX, which might be preferable going forward, as I don't think the Ant Migration Tool is actively maintained any longer.

1
1

Here is a simpler way you could list and get package.xml for all your components you need.

1. Login to https://www.packmagix.com using Salesforce Oauth2 connection.
2. Select component type as 'LightningComponentBundle'
3. Then select all the components you want in your package.xml and click on 'Add to Package' button.
4. Click on 'Download Package.xml' or 'Download Package.zip' button depending on your requirement. It will download package.xml or package.zip respectively.

Select Component List for package.xml

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.