I have a Visualforce Page where I use the AJAX Toolkit to execute Apex methods. In my Apex Class I have this POC method:

WebService static ParametersWrapper testWebserviceMethod(ParametersWrapper params) {
    return params;

And these inner classes:

global class ParametersWrapper {
    webService String testString;
    webService List<TupleWrapper> tuples;

global class TupleWrapper {
    webService String key;
    webService String value;

In the Visualforce Page I have written a JavaScript function which basically contains these line of code:

// Loop over the tuples and create a TupleWrapper object from the XML.
var tuples = [];
$.each(tupleList, function(index, item) {
    var tuple = new sforce.Xml('TupleWrapper');
    tuple.key = item.key;
    tuple.value = item.value;

// Create a ParametersWrapper object from the XML and pass in the data
var params = new sforce.Xml('ParametersWrapper');
params.testString = 'This is a Test';
params.tuples = tuples;

sforce.apex.execute('ApexClassName', 'testWebserviceMethod', {params: params});

When I debug the action, testString is passed along to the method in the Apex Class. But the tuples all come back with key: null and value: null. The amount is in fact correct. So when I pass along 10 tuples, than 10 tuple pairs will all be null for the key and the value variable.

Does any one has any idea how I can use an inner class object with a List of an inner class? Or maybe a workaround?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.