You need to sign in to do that
Don't have an account?
Courtney M Brown
Apex Trigger on Standard Object - help
Hello,
I am using a standard object (Campaign) to track attendence at events. Working with the "Total Contacts" field (automatically updated when a contact is added to campaign) and a custom "No of Attendees" field, I'm trying to create an Apex Trigger that updates the Campaign record with the current number of attendees whenever that number changes.
Goal: Anytime "Total Contacts" changes, I want to pass that value to the "No of Attendees" field.
Here's what I've tried so far:
trigger AttendeeUpdate on Campaign (before update) {
for (Campaign obj: trigger.new){
No_of_Attendees__c = TotalContacts;
}
}
Error Message:Compile Error: Variable does not exist: No_of_Attendees__c at line 3 column 9
Any help with this is greatly appreciated!
I am using a standard object (Campaign) to track attendence at events. Working with the "Total Contacts" field (automatically updated when a contact is added to campaign) and a custom "No of Attendees" field, I'm trying to create an Apex Trigger that updates the Campaign record with the current number of attendees whenever that number changes.
Goal: Anytime "Total Contacts" changes, I want to pass that value to the "No of Attendees" field.
Here's what I've tried so far:
trigger AttendeeUpdate on Campaign (before update) {
for (Campaign obj: trigger.new){
No_of_Attendees__c = TotalContacts;
}
}
Error Message:Compile Error: Variable does not exist: No_of_Attendees__c at line 3 column 9
Any help with this is greatly appreciated!
for (Campaign obj: trigger.new){
obj.No_of_Attendees__c = obj.TotalContacts;
}
}
All Answers
for (Campaign obj: trigger.new){
obj.No_of_Attendees__c = obj.TotalContacts;
}
}