Deleting Components in Managed Packages

Available in: Developer Edition

Note

Note

This feature is available to eligible salesforce.com partners. For more information on the Partner Program, including eligibility requirements, please visit www.salesforce.com/partners.

Starting Spring ‘14, ISVs can delete the following types of components when updating a previously released managed package.
  • Custom Buttons or Links
  • Custom Fields
  • Custom Objects
  • Custom Tabs
  • Field Sets
  • Record Types
  • Validation Rules

The deletion of these components was not supported previously, to avoid the risk of data loss or integration failures in subscriber organizations. However, the number of such components in a complex package can grow very large over multiple release cycles. The ability to delete managed components can be very useful in such cases. It gives ISVs greater flexibility in maintaining and upgrading their apps.

Deleting any component will permanently delete any data that exists in that component, delete tracked history data, and change any integrations that rely on the component, such as assignment or escalation rules. Also, once you delete a component in a managed package, you can’t restore it or create another component with the same name.

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 will still have the deleted components available in their organization. They’re displayed in the Unused Components section of the Package Details page. This ensures subscribers have the opportunity to export data and modify custom integrations involving those components, before explicitly deleting them. For example, before deleting custom objects or fields, customers can preserve a record of their data by going to Setup and clicking Data Management | Data Export.

Note

Note

It’s your responsibility to educate your customers about the potential impact from any components you delete. You should list all custom components you've deleted and notify customers of any actions they need to take, in the Release Notes for your upgraded package.

The following restrictions apply when deleting managed components.
  • A component of any type is not deletable if it’s referenced by any other metadata, such as workflow rules, validation rules, or Apex classes.
  • A custom object is not deletable if it includes any of the following: Apex Sharing Reason, Apex Sharing Recalculation, Related Lookup Filter, Compact Layout, or Action.
  • Deleting a custom field that is referenced by a custom report type in the same package is not recommended, as that will lead to an error when installing the upgraded package.

You can delete managed components, both declaratively, from the user interface, and 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. The process is identical to that for deleting components that aren’t managed. For more information, see the Metadata API Developer’s Guide.