Reply
Regular Contributor
tganikumar
Posts: 34
0
Accepted Solution

Problem with Account object...

Hi,

 

In my environment Account object is not working. Means i written a class like below:

 

public class example{
    public example(){
        Account a = new Account();
        Contact c = new Contact();
    }
}

after clicking save it is giving following error:

 

Error: Compile Error: Constructor not defined: [account].<Constructor>() at line 3 column 21

 

Can you resolve anyone ASAP?

Regular Contributor
Amul
Posts: 24
0

Re: Problem with Account object...

please let me know which Salesforce.com API version are you using?

 

please change your version.

 

Action
Name
Version
Namespace
Type
     
  Salesforce.com API   Salesforce.com API
Trusted Contributor
vishal@force
Posts: 427
0

Re: Problem with Account object...

Are you using this class as a Controller for any visualforce page? Check with that and let me know.

Vishal, Certified Developer and Administrator
Kudos a post if it helps, mark it as solution if it solves.
http://exploretheforce.blogspot.in
Moderator
bob_buzzard
Posts: 6,407
0

Re: Problem with Account object...

Do you have a custom class named Account by any chance?

--
Certified Salesforce Technical Architect, Developer, Advanced Developer, Administrator, Advanced Administrator, Consultant, Sales Cloud Consultant,Service Cloud Consultant
Force.com MVP | The Bob Buzzard Blog | Linked In | Twitter

I don't respond to private messages/emails asking for help.


Take the Bob Buzzard Sobject Fields quiz.

Regular Contributor
tganikumar
Posts: 34
0

Re: Problem with Account object...

Yes bob, your are right? But, why it is giving an error? I think the my class is overriding the standard class...

can you explain in detail?

Regular Contributor
tganikumar
Posts: 34
0

Re: Problem with Account object...

No, but I written the class named as Acount. Then after delete that class it is working fine. But, why it is giving that error? Can you explain in detail?

Moderator
bob_buzzard
Posts: 6,407
0

Re: Problem with Account object...

Your class will override the standard sobject.

 

This is documented at:

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_namespace_prefix.htm

 

in the Namespace, Class and Variable Name Precedence section.

 

You can explicitly refer to the sobject via 'System.Account', but I tend to avoid these naming clashes as it makes maintaining the code tricky.

 

 

--
Certified Salesforce Technical Architect, Developer, Advanced Developer, Administrator, Advanced Administrator, Consultant, Sales Cloud Consultant,Service Cloud Consultant
Force.com MVP | The Bob Buzzard Blog | Linked In | Twitter

I don't respond to private messages/emails asking for help.


Take the Bob Buzzard Sobject Fields quiz.