3

In my scenario, I really want to have a roll-up summary in my master object so I can know which ones doesn't have child objects. Currently it is a lookup relationship which is required and will be automatically deleted if the parent object is deleted.

So from my perspective, I really don't see any difference between this kind of lookup relationship to master-detail. However, it is production so I need to be extremely cautious here. Should I feel safe to change the relationship here?

2 Answers 2

3

Detail records do not have ownership, which will change your sharing model, potentially changing which records are visible to users. Changing between lookup and master-detail will invalidate all reports, report types, and dashboards that use the relationship. Changes will be prohibited if any code references the field, so you may have to alter a lot of code (e.g. pages, components, classes, and triggers). Even though they're technically the same from your perspective, there will be potential side effects. You might want to simply use DLRS instead.

Also, if you just need to know which parent records don't have children, just go in to the Workbench or Apex Data Loader, and you can then simply run the following query:

SELECT Id FROM Parent__c WHERE Id NOT IN (SELECT Parent__c FROM Child__c)

This might suit your specific needs if you're just looking for a one-time clean-up.

1
  • Thank you for that. This relationship is two layers' deep and only one of them has this lookup relationship issue and that's why I was asking. Also, all three objects have several hundred thousand records so it might be inefficient to run through that query.
    – Lance Shi
    Commented Feb 27, 2017 at 6:49
1

You need to perform proper impact analysis before changing the lookup relationship to MD relationship. Hopefully your current Detail object is not in MD relationship that is for sure.

  1. What is the current OWD of Child object which going to be the Detail object.

  2. Is there any sharing rule exist on detail object.

  3. Is the lookup field is mandatory. Hope it is as per your question.

  4. Is there any possibilities that owner of master object and your detail object can be different.

  5. What could be an impact of reporting.

  6. Is there any workflow rules/field update exists on detail object. Verify same in Process Builder.

  7. Is there any validation rule exists on Detail object using that field.

  8. Verify all other code components that you are using with the detail object.

Finally, do your thorough testing on Fullcopy sandbox and move for production.

You must log in to answer this question.

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