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
LeslieSLeslieS 

Class update of Event Record

Hi,
 
I have a simple beginners issue that I hope someone can repsond to.
I want to update the event field "Location" with the customers name & BillingPostalCode when a new event record is created.
 
As you'll see, apex coding is not my strong point yet, but we all need to start somewhere.
 
It bombs with Variable does not exist:  a.Name
 
Code:
public class EventHandler {
// This method updates the Location field on a list
// of Events
public static void addEventHandler(Event[] evnt){
for(Event e: [select Name from Account a where Id IN: e.WhatId]) {
e.Location = a.Name;
}
}
}

 
 
All help gratefully recieved.
 
Leslie