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
Balu Phrabha123Balu Phrabha123 

Custom setting records delete

HI,

How to delete Custom MetaData Records Via Apex class?

custom meta data = Metadata__c

Regards,
Balu
Agustin BAgustin B
Hi Balu, try something like this:
List<String> recordsToDelete = new List<String>();
recordsToDelete.add('My_Custom_Type.record1');
service.deleteMetadata('CustomMetadata', recordsToDelete);

If it solves your issue please mark this answer as correct, it may help others
Agustin BAgustin B
sorry forgot this :
MetadataService.MetadataPort service = new MetadataService.MetadataPort(); 
VinayVinay (Salesforce Developers) 
Hi Balu,

Custom MetaData Records cannot be delete via Apex.

Review below link for same.

https://salesforce.stackexchange.com/questions/212965/how-to-bulk-delete-custom-metadata-records

Below is the Idea link please vote.

https://success.salesforce.com/ideaView?id=0873A000000PZWDQA4

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar
Bernard MillerBernard Miller
I think don't use post entire code.