We need an additional Set of Rollup fields which exceed Salesforce limit of 40 Rollup Fields on master detail records

The trigger should take consideration into all the below scenario's.

  • Should Update the old and Newly assigned parent record if the child record is re-assigned to a different Parent Record.
  • Should update the parent record if all the child records get deleted.

1 Answer 1



Go install Declarative Lookup Rollup Summaries instead. It's free, open source, and thoroughly tested to take into account your scenarios and many others.

You can define your rollups declaratively, store them as Custom Metadata records, and have DLRS automatically generate and deploy the triggers required on both the parent and child objects.

There's no need to spend time reinventing this particular wheel, which has been invented so many times before. If, however, you insist on not using DLRS but creating something bespoke, you will find many references both on SFSE and elsewhere regarding trigger-mediated roll ups.

You must log in to answer this question.

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