You need to sign in to do that
Don't have an account?
chok
trigger syntax
HI,
I am new to apex and triggers when i write the below code its not firing trigger can any one please help me.
Trigger webaccount on Account (after insert) {
for(Account a: Trigger.new)
{
if(a.Website ==null){
a.Website = 'www.google.com';
}
else a.Website = 'froce.com';
}
}
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger webaccount caused an unexpected exception, contact your administrator: webaccount: execution of AfterInsertcaused by: System.FinalException: Record is read-only: Trigger.webaccount: line 5, column 1
Hi,
the error message says record is read-only and this is the case for after insert triggers.
Please review the table here for some important considerations about triggers:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_context_variables_considerations.htm
All Answers
Hi,
the error message says record is read-only and this is the case for after insert triggers.
Please review the table here for some important considerations about triggers:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_context_variables_considerations.htm
thank you for ur time
its helpful for me