You need to sign in to do that
Don't have an account?
Alex Waddell 17
Adding a where clause breaks my Trigger. HELP!
Hello,
I am writing a trigger to update Correspondence records that exist within a certain Pay Period and Year. This information is collected in the Batch record that fires my trigger
The problem I am having is that my Set <Correspondence> SOQL query throws 20+ errors whenever I add a where clause
I am writing a trigger to update Correspondence records that exist within a certain Pay Period and Year. This information is collected in the Batch record that fires my trigger
The problem I am having is that my Set <Correspondence> SOQL query throws 20+ errors whenever I add a where clause
trigger ACH_Email_Update_Trigger_Batch on Batch__c (before update) { for(Batch__c b : trigger.New){ String PayPeriod = b.Pay_Period__c; String Year = b.Year__c; } Set <Correspondence__c> MyCorr = New Set <Correspondence__c> ([Select id, year__c, Pay_Period__c From Correspondence__c Where Pay_Period__c = year]); }Any ideas?
All Answers
Also, if the Pay_Period__c and Year__c are always identical for the batch, then you do not need to loop over them.
Try:
Would your original code be the correct one to go with then? or will Raj's code work regardless?