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
J&A-DevJ&A-Dev 

Need help updating over 100 records with trigger containing 1 element

I'm aware of the governor's limitation that states that we can only process 100 records per element in the trigger. So if the trigger has , let's say, 4 records, then the max number of DML rows that can be processed is 400. In my case, I'm trying to update child records (contacts) when there is a change on a single parent record (account). The challenge is that we have a good number of accounts that have way over 100 contacts. So how should I approach this?

 

I've seen a few posts suggesting the usage of @future, but I'm not quite sure how to put it together. I wrote an s-control that will do this, but I'd like to start moving it so that it runs server side. Any ideas or suggestions will be greatly appreciated.

Message Edited by J&A-Dev on 09-10-2009 01:50 PM
srisomsrisom

If you create a class with a static void method that takes in a Set or List of Account and or Contact Ids, you can simply mark it as @future and get the benefit of 10,000 permitted record updates rather than the trigger limits you mention.  You would need to batch up the ids (in the trigger) of the account and contacts that you need and pass them in.

 

You cannot pass complex types (e.g. lists of actual accounts) so you need to pass in ids and select back what you need in the method.

 

Hope this helps.