• JaimieLives
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

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