4

Here is the scenario: As part of a managed package, we have 3 objects. Object A & Object C are Masters and Object B is the junction object between A & C. We packaged it all up and all good up until now.

However, now while attempting to refactor some of the package code, I no longer need a junction object and would like to remove the relationship that Object B has with A & C.

1) What is the best way, if there is one, to deprecate/delete Object C without deleting A & B? It would be nice if I can downgrade the relationship between B & C to a look up and then upload it to the package but I am not sure that is doable or not. I think it will fail during deploy time.

2) I am ok with downgrading both A & C relationships to lookups instead of master-detail, would I be able to do that as part of managed package?

3) If there is no way of doing this, can I delete Object B from the managed package? This should allow A & C to turn into standalone objects, correct? At which point I can deprecate Object C as needed and recreate a look up relationship between A & B.

Any thoughts? Help would be greatly appreciated! Thanks Praful

2

In general, your ability to change or delete things once included in a managed package is severely limited. Full details are available in the ISVForce Guide, specifically check out pages 20-38, which go over how metadata components can be edited and deleted by both the developer and subscribers.

I haven't tried this myself, but according to the pg. 38, which covers deleting components, custom fields and custom objects are both deletable, except under the following cases:

  • 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.

The docs aren't particularly clear with regards to whether the above apply just for the version you're releasing, our all versions. I'd suspect if you have a reference in any package it'll block it.

I'd recommend just trying it out in your developer org, since it'll tell you immediately if you can't do it. If you can delete it, it'd also be a good idea to install the latest release in a dev org, then doing a beta release to make sure it doesn't cause a bunch of issues from the change (or the install just fails).

  • Essentially what I am hearing is that since there is a relationship, you cannot delete the object. But can I deprecate/delete the relationship itself? Downgrading it to a look up or just deprecating it? – diablodeveloper Jun 26 '14 at 23:13
  • I'm just quoting the docs and what related experience I have, the docs just aren't that clear. I'd recommend giving it a try and then coming back here and posting the results for the next guy. – Ralph Callaway Jun 26 '14 at 23:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.