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
  • 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, 2016 at 14:56

1 Answer 1

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .