I have a business logic as follows.
1. A web service class parses XML file containing case data and loads the case to SF.
2. Trigger that on update of case email field make a call to future method to generate attachment ,send email and update case owner field.
trigger CaseUpdate on Case (After update)
{
for(case c : trigger.old)
{
for(case ca : trigger.new)
{
if((c.Email__c != ca.Email__c) && (c.CS_ID__c != null) && (c.Count__c == 1))
{
UtilsClass.generateReport_Future(c.id);
}
}
}
}
@Future(callout=true)
public static void generateReport_future(String caseId)
{
String result = '';
result = generateReport(caseId);
if(result == '')
{
result = emailReport(caseId);
}
UtilsClass.ChangeOwner(caseId);
}
The issue i am facing is, System.LimitException: Too many future calls: 11, even though single case record is loaded.
Multiple records may be loaded at the same time, but they are sequential(One By One).
Are the records coming in a single batch even though they are being loaded individually..?