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
Kamil MieczakowskiKamil Mieczakowski 

Best Practice for Bulk Lead Uploads with Triggers

I have 5 different triggers calling out to different API services (I am using @future callouts) every time a new lead is added to Salesforce.

My concern is that when I bulk add say 500 leads to Salesforce with DataLoader (haven't tried yet) all those triggers will end up shooting a request out at the same time and I will exceed the rate limits (or at least seriously clog them) for the APIs that I am using ending up in 100s of failed triggers.

Is there a way to ensure that those triggers don't get fired all at once for each lead that is being added but instead respect the rate limits/proceed at a slower pace?
NagendraNagendra (Salesforce Developers) 

Hi Kamil,

Option certainly is to rewrite the triggers, although depending on the org, it can be a real challenge.

Another option is to set your batch size when you upload records. Both in the Apex Dataloader and Dataloader.io, you can configure it. For the first one, it's in the settings as you can see here: 

Hope this helps.

Please mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Regards,
Nagendra