0

I tested this in my dev org for Account object:

Class:

public class Account {
} 

Trigger:

trigger AccountTestTest on Account (before insert) {

   for(Account c: trigger.new){
        c.addError('asddbc');
   }
}

Method does not exist or incorrect signature: [Account].addError(String)

  • 1
    if we use Standard name prefixes we end up getting this mistake. Please avoid using standard name prefix as class name – user39956 Dec 9 '16 at 14:56
2

Your issue is that you created a class named Account. The compiler will look to that class over the SF Implementation of the standard Account class. Keep in mind all sObjects are instances of a Class themselves

Since you did that and did not define a method named addError it does not exist

public class Account {
} 

Strongly Suggest you delete the Account class and you should be good to go

| improve this answer | |
  • renaming the class will also help. – user39956 Dec 10 '16 at 10:36
  • public class AccountAddition{} – user39956 Dec 10 '16 at 10:48
  • @user39956 renaming the class effectively removes the 'Account' class. So yes that works to – Eric Dec 10 '16 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.