function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Admin User 9581Admin User 9581 

Having trouble referencing Account object in trigger. Code fails "Fatally"

Trigger UpdateParentAcct_OldOrg on Account ( after update) {
    
 // the line below fails;
Account a;

     
}
Greg HGreg H
Not sure if you have a specific question or if this is merely a comment.

There are trigger context variables to which you have access and can use within your trigger. See those in this documentation: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_context_variables.htm.

I recommend iterating over all of the records using something like:
trigger UpdateParentAcct_OldOrg on Account(after update) {
    for (Account a Trigger.new) { //for all new versions of Accounts being processed via trigger logic
        System.debug('Account Name: '+a.Name); //show the Name in the debug log
    }
}
Let us know if you have a specific question.
-greg
Admin User 9581Admin User 9581
Greg thanks, but this also does not matter:
Trigger UpdateParentAcct_OldOrg on Account ( after update) {
    
 // the line below fails;
 for(Account a: Trigger.new)
{

}
    
}

The instant I reference the  "Account" object the code fails, meaning no changeset can be validated, no "Force.com" file is saved to the server.
It's weird.