You need to sign in to do that
Don't have an account?
JaimieLives
Apex Trigger -- compile error - variable does not exist?
OK. I'm tired, but can someone tell me why I keep getting "Error: Compile Error: Variable does not exist: c at line 42 column 16", when "c: is defined just a few lines above? Here's the relevant code...
trigger createCaseFromProject on SFDC_Project__c (after insert) { // iterate over the list of Project records being processed in the trigger and // create the required cases for (SFDC_Project__c prj : Trigger.new) //Define the Cases to Insert, then insert them // 01230000001B8slAAC Account & Billing Case c = new Case( RecordType = '01230000001B8slAAC', Project__c = prj.Id, Subject = prj.Account__r.Name & ': Subject ', Description = ' Description ', Origin = 'From Project', SuppliedEmail = prj.Customer_Contact__r.Email, Contact = prj.Customer_Contact__r.Id, Account = prj.Account__r.Id, Status = 'New' ); insert c; }
The error is apparently in the line "insert c;"
But the variable is defined at the line "Case c = ..."
Or have my tired eyes missed something silly?
Thanks,
JaimieLivest
you missed to enclose the codes in for loop with curly braces {}
All Answers
you missed to enclose the codes in for loop with curly braces {}
Doh! Thanks!
Jaimie