0

I have been trying to find out how adding a new master-detail field to a released object (Object released in SF Managed Package), would impact the upgrade process.

As far as adding master-detail relationship to an existing object is concerned we would normally add the field as lookup, populate the values in all data and then convert the field to master-detail.

Do we have to follow a similar approach for package release ?

  • Create an intermediate version where we add the field as lookup.
  • Add value(s) in the lookup field in the client org(s), for all the existing data in client org
  • Release another version of managed package where the lookup field is converted to Master-detail
  • Apply the upgrade in client org(s).

I have searched for the impact of adding Master-detail relationship in the ISV guide but with no luck.

Any help would be greatly appreciated.

1
  • In your second test when you had it Master Detail and then tried to convert to Lookup, did you happen to create any rollup fields between the master and child before? The only reason I ask is because if you were to manually change a non-managed Master Detail object, the "Change Field Type" button does not appear if there are any rollup fields that exist.
    – Sam
    Apr 25, 2017 at 19:49

1 Answer 1

1

Found an answer to my own question.

Looks like it isn't possible to add a master detail relationship to an object previously released in a managed package.

I did the following:

a. Created a new managed release package in a SF org with a single object

b. Tried to add a new master detail field on the released object and got the following error.

Error in the image

Edit: I tried an alternate approach where I added the master-detail relationship field as lookup in an intermediate release.

Then tried to change the field type of the object. However, SF didn't allow me to change the field type :(

Attempted conversion of lookup to master detail

2
  • another thread exists for this salesforce.stackexchange.com/questions/33855/…
    – Learner
    Nov 16, 2015 at 4:04
  • The reason why is if you upgrade a package with a new MD relationship the existing records would not have a value for the field (and it is required to have a value). Even without a managed package the only way to add a MD relationship is if no records exist otherwise you get the error "You cannot create a new Master-Detail relationship on an existing custom object if records already exist"
    – Eric
    Apr 25, 2017 at 22:24

You must log in to answer this question.

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