How to Delete Components from a Managed - Released Package?
Deletion of components is required when a component is no longer in use or a particular component has conflicted with some other components with the same name of the destination org where the package has to install.
Below are some key types of components you can delete when updating a previously released managed package :
- Custom buttons or links
- Custom console
- Custom fields
- Custom objects
- Custom settings
- Custom tabs
- Permission sets
- Record types
- Static resources
- Validation rules
- Visualforce components
- Visualforce pages
Things that keep in mind before deleting a component from a managed package :
- Once a component is deleted from a managed package, you can’t restore it.
- Another component can't be created with the same API name.
- In managed packages, the API name of fields must be unique and cannot be reused even after you delete the component. This restriction prevents conflicts during package installation and upgrade.
Steps to enable Component Deletion in your packaging org :
- Log a case in the Partner Community and ask them to enable Managed package component Deletion in your Org. To create a partner community account, Read this Article
- Salesforce support will ask for your salesforce packaging org ID and some other basic information. Steps to get your salesforce login id: a) Go to set up and enter company profile in the quick find box. b) Click company profile and you will get all your organization detail.you will find you org id corresponding to Salesforce.com Organization ID field.
- Once you provide all these information you will receive an email confirming Managed package component deletion has enabled in your Org.
Another set of things that one should keep in mind while deleting components from a managed package :
- Any data or metadata that has deleted from the package, doesn't delete from the installing org until it is specifically deleted from there. Even after the installation of the latest package, they are still there if not specifically deleted.
- All the deleted components will show in the unused Components section of the Package Details page.
- Any data in the deleted components can be retrieved before specific deletion of components from the package.
Limitations while deleting components from a managed package :
- Any component can't be deleted if it includes in any other metadata, such as workflow rules, validation rules, or Apex classes.
- A custom object can't be deleted if it’s referenced in any of the following: Apex Sharing Reason, Apex Sharing Recalculation, Related Lookup Filter, Compact Layout, or Action.
- Deletion of any custom field that is included in a custom report type is not advisable, if you do so then it will cause an error while installing the latest package.