+ Start a Discussion
The KnightThe Knight 

Is there a way to delete custom labels programatically?

I want to remove all the custom labels in my org. Can this be done using destructivechanges.xml? Or is there a way to do that?

 

 Any help will be appreciated.

 

 

mtbclimbermtbclimber
Yes, you should be able to delete them through the metadata api with the appropriate deployment configuration.  There is no other way to programmatically delete them.
treasingersfdctreasingersfdc

Where you able to use destructiveChanges.xml to delete CustomLabels? I have tried to do that and I always get an error "No CustomLabels named: ... found" even though I know the label exists in the org.

Anil SomasundaranAnil Somasundaran
You can remove the custom label from the org using ant script. In destructiveChanges.xml
<types> 
     <members>name_of_label</members> 
     <name>CustomLabel</name> 
</types> 
<version>42.0</version>