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
abdul kalam 13abdul kalam 13 

Error: Compile Error: Method does not exist or incorrect signature: [Account].adderror(String) at line 7 column 12

Hi, 
I am new for salesfore, and I got this error please solve it
trigger TriggerAccount on Account(before insert)
{
    for(Account a :Trigger.New)
    {
        if(a.AccountNumber==null)
        {
           a.addError('Sorry'); 
        }
    }
}
Rahul GoyalRahul Goyal
This is perfectly working fine as tried in my dev sandbox...I am getting error if account number is null before inserting the record...
Shashikant SharmaShashikant Sharma
Syntax looks fine, just make sure your Apex Trigger version is latest. Let me know what is the version if you still get issue.

Thanks
Shashikant
Amit Chaudhary 8Amit Chaudhary 8
HI abdul kalam 13,

It look like you have one Apex class with Account name ? If yes then please rename apex class or delete and then try above trigger again,
Please let us knw if this will help u

Thanks
Amit Chaudhary
 
abdul kalam 13abdul kalam 13
Ok, I will do it now Thanks Amit