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

Null Pointer Exception on BeforeDelete trigger
getting a null reference exception on the line in bold, I don't understand why...
Am I passing the wrong kind of trigger parameter (Trigger.new)?
System.NullPointerException: Attempt to de-reference a null object
Trigger:
trigger tAccountRecordDeleteBefore on Account (before delete) {
cAccountRecordDeleteBefore.TrackDelIntegrationAccount(Trigger.new);
}
Called Class:
public class cAccountRecordDeleteBefore {
public static void TrackDelIntegrationAccount(Account[] accs){
List<Deleted_Accounts__c> delList = new List<Deleted_Accounts__c>();
Deleted_Accounts__c acct = new Deleted_Accounts__c();
for(Account a:accs){
if(a.Sent_To__c == true){
acct = new Deleted_Accounts__c();
acct.Name = a.ID;
acct.Last_Sent_Time__c = a.Sent_Time__c;
delList.add(acct);
}//end if
}//end for
if(delList.size()>0){
insert delList;
}
}
}
Message Edited by carramrod on 12-18-2008 11:22 AM
Message Edited by carramrod on 12-18-2008 11:25 AM
Am I passing the wrong kind of trigger parameter (Trigger.new)?
System.NullPointerException: Attempt to de-reference a null object
Trigger:
trigger tAccountRecordDeleteBefore on Account (before delete) {
cAccountRecordDeleteBefore.TrackDelIntegrationAccount(Trigger.new);
}
Called Class:
public class cAccountRecordDeleteBefore {
public static void TrackDelIntegrationAccount(Account[] accs){
List<Deleted_Accounts__c> delList = new List<Deleted_Accounts__c>();
Deleted_Accounts__c acct = new Deleted_Accounts__c();
for(Account a:accs){
if(a.Sent_To__c == true){
acct = new Deleted_Accounts__c();
acct.Name = a.ID;
acct.Last_Sent_Time__c = a.Sent_Time__c;
delList.add(acct);
}//end if
}//end for
if(delList.size()>0){
insert delList;
}
}
}
Message Edited by carramrod on 12-18-2008 11:22 AM
Message Edited by carramrod on 12-18-2008 11:25 AM
Try Trigger.old
More information here: http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_triggers_context_variables_considerations.htm
Thanks.