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
DrBix65DrBix65 

Sending Lists of Objects to a RemoteAction Method

I have two remote actions in my class that are simalar to this:

 

@RemoteAction

public static List<Statement__c> getStatements () {

}

 

@RemoteAction

public static void saveStatements (List<Statement__c> statements) {

}

 

and in my Visualforce page, I have Javascript that looks like this:

    StatementFunctions.getStatements (selectedList, function (results, event) {
        arrayOfStatements = results;

    });

 

Later in the Visualforce page, I call:

    StatementFunctions.saveStatements (arrayOfStatements) {

    });

 

This is all working very well with one exception.  The Statement__c object has master detail with another object Line_Item__c so that one Statement__c object can have many Line_Item__c objects.  When the statement object has no line items, it works.  However, when child objects are returned in the list, it fails with an exception (and no message as to why).  Developer console doesn't help either, which makes me think that the data is not being serialized or deserialized in the Javascript correctly.

 

Has anyone seen this behavior before, or does anyone have a solution to how to fix this problem?

 

Thanks in advance.