9

Let's say I have two levels of master-detail relationships. Grandparent object is master-detail to Parent obj, which is in turn master-detail to Child object.

I have an existing Granparent record G1. I also have an existing Parent record P1, which is a child of G1. There are no triggers, summary rollups, workflows, etc on any of the objects. I insert a new Child record, and set the master-detail to P1.

I know this places a lock on P1. Does it also place a lock on G1?

If not, what about if I had a summary rollup field on Parent that rolls up from Child. I assume then that inserting that Child rec would lock G1?

Thanks much!

1 Answer 1

8

G1 would not ordinarily be locked in the first scenario, because P1 is not being inserted or deleted, and has no reason to lock G1. G1 may be locked by P1 in the presence of rollup summary fields, but this requires both P1 and G1 have rollup summary fields defined for their respective children. You can examine the complete list of rules in the Record Locking Cheat Sheet.

3
  • "G1 would not ordinarily be locked in the first scenario, because P1 is not being inserted or deleted, and has no reason to lock G1." OK, that's what I thought, thanks! "G1 may be locked by P1 in the presence of rollup summary fields, but this requires both P1 and G1 have rollup summary fields defined for their respective children." Are you sure? Because if there's a rollup from child to P1, doesn't that cause an update to P1? Which would lock G1 via the master-detail? Thanks, @sfdcfox!
    – mscholtz
    Dec 4, 2016 at 20:15
  • 1
    @mscholtz An update on a child in a master-detail isn't an automatic lock, if you look at the cheat sheet. If you're changing the master-detail Id, or if there's a rollup-summary, then yes, but otherwise master-detail only locks the master on insert and delete, not update.
    – sfdcfox
    Dec 5, 2016 at 0:49
  • Ah, gotcha! Wasn't thinking of the difference between the insert on the child rec vs. the update on the update on P1. Thank you!
    – mscholtz
    Dec 5, 2016 at 6:27

You must log in to answer this question.

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