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
Shivani Tinker 7Shivani Tinker 7 

custom metadata deletion

Hi,
I am not able to delete custom metadata as well as its records, not able to update them with the same name, and also I am not able to change custom metadata records name. This custom metadata is a part of a managed package.

Thanks,
Shivani
Best Answer chosen by Shivani Tinker 7
AbhishekAbhishek (Salesforce Developers) 

Components Available in Managed Packages (https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/packaging_packageable_components.htm#packaging_packageable_components) shows that lightning component can't be deleted, once they are part of Managed Release Package.

For further reference you can check this,

https://developer.salesforce.com/forums/?id=906F0000000MJjIIAW

 

All Answers

AbhishekAbhishek (Salesforce Developers) 
Shivani,

Custom MetaData types are not records that are stored in the database, they are part of Org's customization XML. Thus you cannot delete them like you usually delete Account, Contacts, or custom settings.

You need to alter the org's metadata to do so.

There are 2 ways to do this.

1.Using ANT aka Force.com Migration Tool: You have to create a destructive changeset, that will delete the corresponding metadata.
SRC: https://salesforce.stackexchange.com/a/200369/19118

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

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

If it is a part of the managed package it might help or not, But give it a try.


Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.
Shivani Tinker 7Shivani Tinker 7
Hi Abhishek,

This custom metadata is a part of my managed package. I tried to delete it and it's records, but I am not able to do so even I tried with destructive changeset still get below error while deleting.

User-added image

Thanks!
AbhishekAbhishek (Salesforce Developers) 

Components Available in Managed Packages (https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/packaging_packageable_components.htm#packaging_packageable_components) shows that lightning component can't be deleted, once they are part of Managed Release Package.

For further reference you can check this,

https://developer.salesforce.com/forums/?id=906F0000000MJjIIAW

 
This was selected as the best answer