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
agabagab 

Error when invoking an Apex method with arguments from an s-Control

Hello,
I have an Apex method that takes an argument; I am invoking this method from an s-Control.  The call works fine when I invoke the method with no arguments or with an argument such as a String or a Standard SF Object (e.g. Lead, Account, etc...).  However when the argument is of the type of my own Apex Class i get the following error:
 
{faultcode:'soapenv:Client',faultstring:'There is no public member called 'type' in the Apex class 'myApexClass',}
 
'myApexClass' in fact does not have an attribute called 'type' (which is a reserved keyword so I cannot create such an attribute anyway) and nowhere in my code am I referring to such an attribute so I do not understand why it is looking for it.
 
Has anyone encountered this error before?  Thanks.
 
agab-
mikefmikef
agab:

So you can't pass in a class into an argument for a method. You can pass in an instance of that class into an argument for a method.

I think the error message is not telling you what the issue really is.

In your scontrol you need to create an instance of that Apex class then pass the instance to the class.

I am just guessing here but this is what I would think of if I were faced with the same issue.


cheenathcheenath
See this post:

http://community.salesforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=5312


agabagab
Thanks Mike.  I finally figured out what I was doing wrong.  I was instantiating my "Apex class" objects using the
"new sforce.sObject" method instead of "sforce.Xml".   I had no idea there was such a method, still cannot find it in the Apex an Ajax guides.
agabagab
Thanks cheenath.  As I was telling Mike in my earlier reply, my problem was that I was instantiating my "Apex class" objects using the
"sforce.sObject" method instead of "sforce.Xml".   I believe I came across the thread you listed and that's how I discovered that there is such a method as sforce.Xml.