0

I'm working on a managed package where I need to delete a field. The field is member of a custom report type in the same package. Salesforce documentation does not recommend deleting a field member of custom report type and as per documentation such deletion leads to an error when installing the upgraded package. please advise if it can cause any error and the steps through which we can delete the field successfully and upgrade the package

References: https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/packaging_managed_component_deletion.htm#:~:text=Salesforce%20doesn't%20recommend%20deleting,when%20installing%20the%20upgraded%20package.&text=Any%20version%20of%20the%20package,invalidated%20and%20cannot%20be%20installed. https://help.salesforce.com/articleView?id=design_your_app.htm&type=5

2
  • Is the managed package installed in any subscriber orgs? Have you performed a managed release, or only managed beta uploads?
    – David Reed
    Jan 6, 2021 at 5:37
  • Yes it is installed in subscriber orgs. Its a released managed package Jan 7, 2021 at 5:49

1 Answer 1

2

In our experience, as the ISV/managed package owner of the managed released 1GP, you must:

  1. First remove all usages of the component (here, custom field) from the managed package and release a new version of the package (let's call it version A).
  2. Now delete the component (custom field in this case) from the managed package and release a new version of the package (let's call it version B).

Note that version A can usually be a patch release, but version B cannot.

For a subscriber org to be successfully updated the subscriber must:

  1. Install version A.
  2. Remove any usages of the deleted component (if there are any).
  3. Install version B.

Even if there are no usages, the subscriber org MUST install both versions in the order A then B.

It may have changed, but before we first did this in a 1GP we had to ask Salesforce to enable deletion of managed package components as per this knowledge article.

Note that it is currently (Winter '21) not possible to delete components from a managed 2GP - at least, not when the component exists in an ancestor version.

Note that you may be able to use the "Where is this used" functionality to identify usages.

9
  • +1. Might also be worth noting that you can't "upgrade" the deletion of a field anyway - it just becomes subscriber-deletable.
    – David Reed
    Jan 6, 2021 at 16:00
  • Thanks @Phil . Have you ever tried these steps for deleting a field which is part of any custom report type in same package and it worked? Jan 7, 2021 at 5:56
  • Strictly, no since we don't package reports, but it will work because the first thing you do is remove the use of the field from the report as part of creating version A.
    – Phil W
    Jan 7, 2021 at 7:07
  • @Phil Thanks for the reply. In our case its a custom report type which includes the field to be deleted and its not custom report. Jan 7, 2021 at 9:01
  • Same approach applies - you need to remove the usage from the custom report type.
    – Phil W
    Jan 7, 2021 at 10:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .