- In complex packages, the number of components can grow very large over multiple release cycles.
- Deleting unused managed components allows you to keep your app clutter-free while you maintain and upgrade it.
The following restrictions apply when deleting managed components.
- Deleting a component permanently deletes the data that exists in that component, deletes tracked history data, and changes integrations that rely on the component, such as assignment or escalation rules. When you delete a component in a managed package, you can’t restore it or create another component with the same API name.
- However, no data or metadata is ever deleted in a subscriber organization without specific action by the customer. Subscribers who upgrade to the new package version still have the deleted components available in their organization. They’re displayed in the Unused Components section of the Package Details page. Keeping the components ensures that subscribers have the opportunity to export data and modify custom integrations that involve those components before explicitly deleting them.
- It’s your responsibility to educate your customers about the potential impact of any components that you delete. Salesforce recommends that you list all deleted custom components and notify customers of required actions in the release notes for your upgrade package.
You can delete managed components declaratively from the user interface or programmatically using the Metadata API. In the latter case, specify the components you want to delete in a destructiveChanges.xml manifest file and then use the standard deploy() call.
- If a component is referenced by other metadata, such as workflow rules, validation rules, or Apex classes, you can’t delete that component.
The process is identical to that for deleting components that aren’t managed. For more information about the API, see the Metadata API Developer’s Guide. For more information about deleting components in managed packages, see the ISVforce Guide.
Reference: See Streamline Managed Packages by Deleting Unused Components for more information.