+ Start a Discussion
bpolbpol 

bulk trigger not firing -- not sure why?

I can't tell why this isn't working...

 

Is there a way to add a de-bugging method to the trigger to see what is happening? 

 

How do I know if the first few definitions (particularly of the list "list_relatedstudents" isn't null after I try to define it; then when I go to update the list with "update list_relatedstudents" nothing happens)?

 

 

trigger Bulk_CallLogs on Student_Call_Log__c (after insert, after update) { list<Student_Call_Log__c> list_thelogs = new list<Student_Call_Log__c>(); // list contains all of the logs being processed // Step 1 set <id> list_relatedstudents_temp = new set <id> (); for (Student_Call_Log__c log :list_thelogs) { list_relatedstudents_temp.add(log.related_student__c); } list<Student__c> list_relatedstudents = ([select id, Most_Recent_Call_Note__c, Tech_Support_Logs__c, Call_Count__c from Student__c where id IN :list_relatedstudents_temp]); // Step 2 list<Student_Call_Log__c> list_relatedlogs = ([select id, related_student__c, date__c, note__c from Student_Call_Log__c where related_student__c IN :list_relatedstudents order by Date__c DESC ]); list<Student_Call_Log__c> list_relatedlogs_mostrecent = ([select id, related_student__c, date__c, note__c from Student_Call_Log__c where related_student__c IN :list_relatedstudents order by Date__c DESC limit 1 ]);

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
jeffdonthemic2jeffdonthemic2

You can try placing System.debug() statement in your trigger, adding your user (or whom ever is running the trigger) to the debug log (Setup -> Administration Setup -> Monitoring -> Debug logs) and then running the trigger.

HTH

Jeff Douglas
Appirio, Inc.
http://blog.jeffdouglas.com 

All Answers

jeffdonthemic2jeffdonthemic2

You can try placing System.debug() statement in your trigger, adding your user (or whom ever is running the trigger) to the debug log (Setup -> Administration Setup -> Monitoring -> Debug logs) and then running the trigger.

HTH

Jeff Douglas
Appirio, Inc.
http://blog.jeffdouglas.com 

This was selected as the best answer
bpolbpol
Helpful.  Thank you.