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
V'NathV'Nath 

nstructor syntax, name=value pairs can only be used for SObjects

Stragne:mansad:

 

any thing wrong in my code

 

list<Account> accts = new list<Account>{new Account(name='test account')};

or


Account[] newaccts =new Account[]{new Account(name='dev account')};

bob_buzzardbob_buzzard

Do you have a local class called Account?  That's usually been the issue for me.

edwin_beltranedwin_beltran

Hi,

 

In my case, I do have a Contact class declared locally... is there a way to point to that class instead the global sforce class Contact... like this.Contact... and how can I point to the global class...

 

thanks in advanced... // _e

edwin_beltranedwin_beltran
hi, if helps... finally found the Super class that holds the Generic objects from Salesforce.... is Schema. If you have a local class called like one of the salesforce objects, use the name of the class to access that class and if you want to access one of the global objects, use Schema.'ClassName' global class MyWebMethods { class Contact { string name; } } MyWebMethods.Contact <- local Schema.Contact <-global hope this helps...