You need to sign in to do that
Don't have an account?
lovetolearn
Error: Compile Error: unexpected token: 'startDate' at line 6 column 100
Hi,
I am trying to create a trigger that creates mutilple junction object records. I keep getting the following error: Compile Error: unexpected token: 'startDate' at line 6 column 100. Here is my code:
trigger testCreateHoliday on Leave_Request__c (after update) { Leave_Request__c insertLR = new Leave_Request__c(); Date startDate = insertLR.Request_Start_Date__c; Date endDate = insertLR.Request_End_Date__c; List<Holiday__c> allHoliday=[SELECT ID FROM Holiday__c Where Holiday__c.Holiday_Start_Date__c > startDate]; insertLR = trigger.new[0]; List<LR_and_Holiday__c> lrholidaylist = new List<LR_and_Holiday__c>(); Integer x = 0; for (integer i = 0; i<=1; i++){ LR_and_Holiday__c lrholiday = new LR_and_Holiday__c(); lrholiday.Leave_Request__c = insertLR.ID; lrholiday.Holiday__c = allholiday[x].ID; lrholidaylist.add(lrholiday); x++; } Database.insert(lrholidaylist); }
Please help. Thank you.
I think the problem is with your SOQL:
It should be:
Difference in :startDate
All Answers
I think the problem is with your SOQL:
It should be:
Difference in :startDate
Thank you.