You need to sign in to do that
Don't have an account?

Whats wrong in the Code
HI ALL,
I am beginner in sfdc.
In the following code i am updating contact records. but following error is coming. i am updating interested_tech__c.
Apex trigger CreateContactAccountInsert caused an unexpected exception, contact your administrator: CreateContactAccountInsert: System.LimitException: Too many future calls: 11
if(trigger.isupdate)
{
String s = 'test';
Set<id> ownerIds = new Set<id>();
for (Contact a :[Select Id,LastName from Contact where lastname like :(s+'%')])
ownerIds.add(a.Id);
Contact[] owners = [Select Id,interested_tech__c from Contact Where Id in :ownerIds for update];
for (Contact Cnt: owners ){
Cnt.interested_tech__c='C';
system.debug('TestMethod'+ Cnt.interested_tech__c);
update Cnt;
}
}
It sounds like you have another trigger on case that is doing a future call, but you may try this. You have to bulkify your update:
if(trigger.isupdate)
{
String s = 'test';
Set<id> ownerIds = new Set<id>();
for (Contact a :[Select Id,LastName from Contact where lastname like :(s+'%')])
ownerIds.add(a.Id);
Contact[] owners = [Select Id,interested_tech__c from Contact Where Id in :ownerIds for update];
for (Contact Cnt: owners ){
Cnt.interested_tech__c='C';
system.debug('TestMethod'+ Cnt.interested_tech__c);
}
update owners;
}
Hi,
This error does reference for Limit of Future "@future" Callouts or calls to webservices. But in your code I dont saw any callout and any @future call.
This error can to be showing becouse you are trying to call update method more than 10 times within of your loop below:
for (Contact Cnt: owners ){
Cnt.interested_tech__c='C';
system.debug('TestMethod'+ Cnt.interested_tech__c);
update Cnt;
}
you can to try this:
for(Integer i=0; i<owners.size();i++){
owners[i].interested_tech__c='C';
system.debug('TestMethod'+ owners[i].interested_tech__c);
}
update owners;
it's same code, but here the update method is called once.
Same Error is Coming...