0

My production Org is presenting this error of too many future calls: 51 This error occurs when the user responsible for this task trys to use the Mass Transfer Records option for Accounts.

Is there anywhere in Salesforce that I can check where and when these future calls are?

The error signs a trigger: But my question is, where do I find the parameters of the Mass Transfer Records? Where in Salesforce cna I check? The Trigger pointed in the Error doesn`t have it?

trigger Trigger_Conta on Account (before insert, before update, after insert, after update) {

System.debug(LoggingLevel.ERROR, '__ [trg DuplicidadeConta ] - Inicio...');
System.debug(LoggingLevel.ERROR, '__ [trg DuplicidadeConta ] - Parametros_ORG__c.getOrgDefaults().Email_usuario_pentaho__c: '+Parametros_ORG__c.getOrgDefaults().Email_usuario_pentaho__c);
System.debug(LoggingLevel.ERROR, '__ [trg DuplicidadeConta ] - UserInfo.getUserEmail(): '+UserInfo.getUserEmail());

System.debug(LoggingLevel.ERROR, '__ [trg DuplicidadeConta ] - System.IsBatch(): '+System.IsBatch());
System.debug(LoggingLevel.ERROR, '__ [trg DuplicidadeConta ] - System.isScheduled(): '+System.isScheduled());
System.debug(LoggingLevel.ERROR, '__ [trg DuplicidadeConta ] - System.isQueueable(): '+System.isQueueable());
//System.debug(LoggingLevel.ERROR, '__ [trg DuplicidadeConta ] - Boolean.valueOf(event.data.get(isApi)): '+Boolean.valueOf(Event.data.get('isApi')));
System.debug(LoggingLevel.ERROR, '__ [trg DuplicidadeConta ] - String.valueOf(URL.getCurrentRequestUrl()): '+String.valueOf(URL.getCurrentRequestUrl()));

if(UserInfo.getUserEmail() == Parametros_ORG__c.getOrgDefaults().Email_usuario_pentaho__c) return;
if(!Triggers__c.getOrgDefaults().Trigger_conta__c) return;

String req = String.valueOf(URL.getCurrentRequestUrl());
if(req.contains('salesforce.com/services/Soap/u/')) return;

try {

    Boolean executou = Handler_Conta.verificacao(trigger.isBefore, trigger.isAfter, trigger.isInsert, trigger.isUpdate, 
                          trigger.isDelete, trigger.isUndelete, trigger.old, trigger.oldMap,
                          trigger.new, trigger.newMap);

} catch (Exception e){

    trigger.new[0].addError(e, false);
}

}

  • 1
    Apparently, there is some loop, which calls future method in apex trigger – kurunve Mar 7 '18 at 2:10
  • possibly run a search through your code base for "future"? cross reference where an Account is being inserted or updated. Also as kurunve mentioned, it's probably happening within a loop, so add the accounts to a map in the loop and then after the loop, insert all at once. – Aequitas Mar 7 '18 at 2:25
  • Thank you for the answers, it was very helpful. But, I am a begginer in Salesforce code, I can't find where in the Salesforce the Mass Transfer Records is configured, where is the code of this functionality. Thanks for your patience. – Juliano Szlachta Mar 7 '18 at 12:02
  • Mass Transfer Records is an installed application. Look in Setup > Installed Packages and in the Mass Transfer app you'll be able to see the components of the package. – David Cheng Mar 8 '18 at 2:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.