I have a method in a trigger dispatcher that's being called in a recursive but seemingly untraceable fashion. The following log entries just repeat over and over until I reach maximum stack depth.
01:55:52:392 METHOD_ENTRY [EXTERNAL]|01pK0000000bnon|AffiliationTriggerDispatcher.afterDelete(TriggerParameters)
01:55:52:392 VARIABLE_SCOPE_BEGIN [93]|this|AffiliationTriggerDispatcher|true|false
01:55:52:392 VARIABLE_ASSIGNMENT [93]|this|{}|0x1a58d93c
01:55:52:392 VARIABLE_SCOPE_BEGIN [93]|arg0|TriggerParameters|true|false
The method (below) at line 93 is invoked but line 94 is never executed and never shows up in the debug logs.
public virtual override void AfterDelete(TriggerParameters tp) {
System.debug('line #94: entered AfterDelete method');
if(!isAfterDeleteProcessing) {
isAfterDeleteProcessing = true;
execute(new AffiliationAfterDeleteTriggerHandler(), tp, TriggerParameters.TriggerEvent.afterDelete);
isAfterDeleteProcessing = false;
}
else execute(null, tp, TriggerParameters.TriggerEvent.afterDelete);
}
The event which causes the trigger to run is a simple test for deleting affiliations. Deactivating every affiliation workflow and a Salesforce NPSP affiliation trigger made no difference. This method is part of a 1 trigger framework I've used elsewhere without trouble.
Any thoughts on how I can find out how the afterDelete method is being called? Thanks in advance.
Following sfdcfox's helpful suggestion, I added a checkpoint at my debug line, #94, which generates the following additional log line:
15:01:13:167 PUSH_TRACE_FLAGS [EXTERNAL]|01pK0000000bnon|AffiliationTriggerDispatcher|APEX_CODE,FINEST;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;NBA,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WAVE,INFO;WORKFLOW,INFO
However, I still don't see that line 94 is executed or what external event is invoking the afterDelete method over and over.
Can also attest to the fact that the afterDelete triggerhandler method(s), which the dispatcher class should be sending a message to, are never invoked either, which also indicates that the method body below is not entered.
Update: I eventually found the line of code that was causing this, or specifically the missing closing curly brace in the Trigger Factory class. It wasn't [EXTERNAL], as the log indicated. A more accurate log entry would have saved me a lot of time. Thanks everyone for your help.
execute
method is called (within theexecute
method that is)