My question is bit similar to this. But I'm getting a Runtime exception in SF. Not getting a compiler error, but in Apex, it's throwing,

FATAL_ERROR System.UnexpectedException: Salesforce System Error: 1996097431-19512 (-1753594556) (-1753594556)

and Callback fails with javascript error,

WARNING: Callback failed: apex://MyDev.Test1Controller/ACTION$saveDataDML

I'm trying to send List from Helper to Apex controller.

Wrapper class:

public with sharing class Wrapperclass {

    public CustObjA__c Inv{get;set;}

    public CustObjB__c Trans{get;set;}

    public String userMsg{get;set;}

Aura markup:

<aura:attribute name="processedItems" type="Wrapperclass[]" access="public" />

My callback function:

saveScannedData: function(component) {

var itemList = component.get('v.processedItems');

// Run Asynchronous call to save data
var actSave = component.get("c.saveDataDML");
    "listToSave": itemList
    //"listToSaveString": JSON.stringify(itemList)
    //"listToSaveString": $A.util.json.encode(itemList)

actSave.setCallback(this, function(response) {

    var state = response.getState();

    console.log('Save response: '+state);

    if (component.isValid() && state == "SUCCESS") {
        var ret = response.getReturnValue();
    } else {

        var errors = response.getError();

        console.log('No. of error msgs: ' + errors.length);

        if (errors) {
            if (errors[0] && errors[0].message) {
                console.log("Error message: " + errors[0].message);
            } else {
                console.log('Weird error: ' + errors[0].message);

        } else {
            console.log("Unknown error");




Apex controller:

public static List<Wrapperclass> saveDataDML(List<Wrapperclass> listToSave){
           for(Wrapperclass item :listToSave){
                String errMsg = valWrapperclass(item);

                if (String.isEmpty(errMsg)){
                    // Add to Transaction list
                    item.userMsg = errMsg;
                    hasError = true;


It actually fails just before the below line in Apex controller.

for(Wrapperclass item :listToSave)

Appreciate any help on this. Thanks.

  • 1
    I think this is presently broken and requires a workaround - see e.g. the answer to Confirmation that (inner) classes are still not fully supported in @AuraEnabled methods?.
    – Keith C
    May 3 '17 at 12:28
  • 1
    That's good. Would be good if this got fixed but we'll have to wait and see. You can answer your own question and accept that answer after a couple of days: best to be clear about what change you needed to make to help others.
    – Keith C
    May 3 '17 at 12:58
  • Makes me sad this is still not supported :-( Sep 12 '17 at 10:59
  • what is not supported? it works fine. you can ask your question with the code you tried and copy link over here if you need any help. Sep 12 '17 at 23:27

Fixed using this approach.

In Java script Callback,

var actSave = component.get("c.saveDataDML");
            "listToSaveString": JSON.stringify(itemList)

and in Apex Controller, Deserialized an casted as below.

public static List<Wrapperclass> saveDataDML(String listToSaveString){

List<Wrapperclass> listToSave = (List<Wrapperclass>)JSON.deserialize(listToSaveString, List<Wrapperclass>.class);

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.