function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Aslam_Kamal_86Aslam_Kamal_86 

Change of owner of related records.

hi,

 

We have a requirement, where we need to change the owner of all the related objects, when the owner of that account is changed.

 

We developed a trigger to do this, however it so happenes that sometimes several hundreds (or thousands) of accounts needs to updated at once. When this happens, it throws a "Too many SOQL" exception.

 

We thus thought of using future classes for achieveing the same. Could anyone tell how reliable it is and how it would perform when a bulk of thousand records come for updation?

 

Thanks in advance..

werewolfwerewolf
Indeed, @future would be the right way to do this.  Be sure to do as many queries and updates in bulk as you can though -- even @future methods have limits.  @future methods perform just fine, usually completing quite quickly after invocation.