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
beingofhabitsbeingofhabits 

Delete Custom metadata type record using tooling api

GoodDay

So, as Salesforce doesn't provide us with any way to delete custom metadata type record via Metadata API, am I able to delete it by Tooling, REST or Soap APIs? If so, I please you to provide me with links or code samples

Have a nice day
Best Answer chosen by beingofhabits
Raj VakatiRaj Vakati


 
There are 2 ways to do this.
Using ANT aka Force.com Migration Tool: You have to create a destructive changeset, that will delete the corresponding metadat.
 
https://salesforce.stackexchange.com/a/200369/19118

Using Apex MDAPI API: Apex MDAPI is a Apex wrapper for inbuilt MetaData API which can be used to alter metadata of the org.


  https://github.com/financialforcedev/apex-mdapi


https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_custommetadata.htm?search_text=CustomMetadata

All Answers

Raj VakatiRaj Vakati


 
There are 2 ways to do this.
Using ANT aka Force.com Migration Tool: You have to create a destructive changeset, that will delete the corresponding metadat.
 
https://salesforce.stackexchange.com/a/200369/19118

Using Apex MDAPI API: Apex MDAPI is a Apex wrapper for inbuilt MetaData API which can be used to alter metadata of the org.


  https://github.com/financialforcedev/apex-mdapi


https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_custommetadata.htm?search_text=CustomMetadata
This was selected as the best answer
Sreenivasa Rao MariyavulaSreenivasa Rao Mariyavula
lease refer the below post for using the metadata service with apex.
https://www.srinivas4sfdc.com/2022/06/how-to-delete-custom-metadata-records.html