You need to sign in to do that
Don't have an account?
Dipen Ishani
ERROR: SubscriberUpdateTrigger: System.LimitException: Too many future calls: 51
Hi All
When updating 115 record through data loader,
i got this error message.
ERROR: UpdateTrigger: System.LimitException: Too many future calls: 51
Originally I thought it was because i was updating more than 50 record.
but I tried it again with 50 record and got the same message.
Plz guys help me out as soon as possible, i will be grateful.
If required to display my code then let me know.
Thanks in advance
When updating 115 record through data loader,
i got this error message.
ERROR: UpdateTrigger: System.LimitException: Too many future calls: 51
Originally I thought it was because i was updating more than 50 record.
but I tried it again with 50 record and got the same message.
Plz guys help me out as soon as possible, i will be grateful.
If required to display my code then let me know.
Thanks in advance
If possible please update your code to bulkify smiliar the way you did for triiger.new or else please use the getLimitFutureCalls() to limit
the number of future calls as per gov limits.
Please find the below link to get more details on how to find the gov limits.
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_limits.htm#apex_System_Limits_getLimitFutureCalls
if(deleteflag){
if(Trigger.isUpdate){
for(Subscriber__c subs : Trigger.old) {
MDLiveIntegration.deleteSubs(subs.MDLIVE_ID__c,subs.id);
}
}
}
All Answers
It would help if you can provide me with the code, but before that please check if you're calling the future method inside a loop, there might be multiple future calls because of that.
Best Regards
Naga Kiran
trigger SubscriberUpdateTrigger on Subscriber__c (after Insert, after Update, after delete) {
List<ID> subRecords = new List<ID>();
List<ID> subUpdateRecords = new List<ID>();
Boolean deleteflag = false;
if(!trigger.IsDelete) {
for(Subscriber__c subs : Trigger.new){
if(subs.Active_Subscriber__c == true && subs.Auto_Telemedicine__c == true){
Boolean needsUpdate = false ;
if(Trigger.isInsert){
needsUpdate = true;
}
else if (Trigger.isUpdate){
needsUpdate = false;
}
if(needsUpdate)
subRecords.add(subs.id);
else
subUpdateRecords.add(subs.id);
}
else
{
deleteflag = true;
}
}
if(subRecords.size() >0){
if(system.isFuture())
return;
MDLiveIntegration.insertSubs(subRecords);
}
if(subUpdateRecords.size() >0){
if(system.isFuture())
return;
MDLiveIntegration.updateSubs(subUpdateRecords);
MDLiveIntegration.reactiveSubs(subUpdateRecords);
}
}
else
{
for(Subscriber__c subs : Trigger.old) {
if(subs.Active_Subscriber__c == true && subs.Auto_Telemedicine__c == true){
MDLiveIntegration.deleteSubs(subs.MDLIVE_ID__c,subs.id);
}
}
}
if(deleteflag){
if(Trigger.isUpdate){
for(Subscriber__c subs : Trigger.old) {
MDLiveIntegration.deleteSubs(subs.MDLIVE_ID__c,subs.id);
}
}
}
}
If possible please update your code to bulkify smiliar the way you did for triiger.new or else please use the getLimitFutureCalls() to limit
the number of future calls as per gov limits.
Please find the below link to get more details on how to find the gov limits.
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_limits.htm#apex_System_Limits_getLimitFutureCalls
if(deleteflag){
if(Trigger.isUpdate){
for(Subscriber__c subs : Trigger.old) {
MDLiveIntegration.deleteSubs(subs.MDLIVE_ID__c,subs.id);
}
}
}
Let me know if you need any more help.
Regards,
BDatla
I make the change in my code as said and i got the solution.
Thank you for your great help.