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
Joseph FerraroJoseph Ferraro 

asynchronous apex limits questions

I'm sure these questions have been covered somewhere on this board, but I could not find them via search...

1. Is the limit for @future calls 200 per org per 24 hours OR 200 per license per 24 hours?

2. If it's 200 per org per 24 hours, can this limit be raised?

3. Lastly, I have a trigger on leads that calls an @future class after insert and when I check the apex job queue, hundreds of jobs show up in the queue even when we load a list of 500 or so leads via the import wizard. For a list of 500 or so leads, wouldn't that only generate 3 @future calls, assuming the batch size is 200? (and yes, I've written the aforementioned trigger for bulk processing)

Thanks in advance!!
EJWEJW
1) 200 per license per 24 hours.

3) Not sure, I'd have to see how you're making the @future call.
Joseph FerraroJoseph Ferraro
Code:
trigger routeLead on Lead (after insert) 
{
 Set<Id> myLeadIdsToRoute = new Set<Id>();
 
 for (Lead l : Trigger.new)
 {
  myLeadIdsToRoute.add(l.id); 
 }
 
 LeadAssignment.routeLeads(myLeadIdsToRoute);
}

 my async method "routeLeads" does not call any other methods.  is the reasoning in the third point of my first post incorrect?
EJWEJW
Your code looks fine to me, it could be that the import wizard wasn't batching the inserts for some reason. Have you attempted the import again with the debug log enabled? It can be enabled via Setup->Monitoring->Debug Logs. The log should indicate how often your routeLead trigger is being fired.
Joseph FerraroJoseph Ferraro
Thanks for the reply.  I think Salesforce should make the documentation more clear on the @future limits question, because I've seen it expressed as:

"No more than 200 method calls per Salesforce license per 24 hours" in the @future annotations documentation

AND

"Salesforce also imposes an organization-wide limit of 200 method calls with the future annotation per 24 hours." in the governor limits documentation