You need to sign in to do that
Don't have an account?
darkwater
Issue in passing parameters to webservice
Hello community,
I got the following global classes
I have created a button on a custom object and my content source is onlick javascript and the following is my javascript code
When I click that custom button, it calls mywebservice method and I got the following log
How do I pass list of primitive types or sobjects or user defined types to a webservice class as parameters?
Thanks,
I got the following global classes
/* * myClass */ global class myClass{ webservice static String myWebservice(myTestClass test){ System.debug('test is '+test); return ''; } } /* * myTestClass */ global class myTestClass{ webservice String myString; webservice wrapperClass[] wrapperClassList; } /* * wrapperClass */ global class wrapperClass{ webservice String myWrapperString; }
I have created a button on a custom object and my content source is onlick javascript and the following is my javascript code
{!requireScript('/soap/ajax/32.0/connection.js')} {!requireScript('/soap/ajax/32.0/apex.js')} var obj = new sforce.Xml('myTestClass'); obj.myString = 'someString'; obj.wrapperClassList = new Array(); var wrapperClass = new sforce.Xml('wrapperClass'); wrapperClass.myWrapperString = 'wrapperstring'; obj.wrapperClassList.push(wrapperClass); var myId = sforce.apex.execute('myClass','myWebservice',{test : obj}); document.location = '/someid';
When I click that custom button, it calls mywebservice method and I got the following log
myTestClass:[wrapperClassList=(wrapperClass:[myWrapperString=null]), myString=someString]I expect myWrapperString as 'wrapperstring' but for some reason, it shows as null.
How do I pass list of primitive types or sobjects or user defined types to a webservice class as parameters?
Thanks,
http://salesforce.stackexchange.com/questions/46784/how-to-pass-parameters-in-web-service-class-in-salesforce