I am trying to pass a list from lightning controller to apex. My system debug returns records with null values what am I missing? My debug on clientside returns values.
Controller Clientside
saveRecords : function(cmp, event, helper) {
var act = cmp.get("c.updateInvoices");
var updatedInvoiceList = cmp.get('v.handleInvoices');
alert('updatedInvoiceList: ' + updatedInvoiceList[1].selectedOption);
act.setParams({ "invoices" : updatedInvoiceList});
$A.enqueueAction(act);
alert('DONE');
}
Controller Serverside @AuraEnabled public static void updateInvoices(List<Invocable_Obj_HandleInvoice> invoices){ system.debug('[testHandlInvoice]invoices: ' + invoices); Invocable_Obj_HandleInvoices.HandleInvoices(invoices); }
Debug logs
USER_DEBUG|[34]|DEBUG| [testHandlInvoice]invoices: (Invocable_Obj_HandleInvoice:[availableOptions=null, balanceAmount=null, customerName=null, handlingStatus=null, invoiceId=null, invoiceNumber=null, selectedOption=null, totalAmount=null, zuoraStatus=null], Invocable_Obj_HandleInvoice:[availableOptions=null, balanceAmount=null, customerName=null, handlingStatus=null, invoiceId=null, invoiceNumber=null, selectedOption=null, totalAmount=null, zuoraStatus=null])
USER_DEBUG|[21]|DEBUG| [Invocable_Obj_HandleInvoices]invoices: (Invocable_Obj_HandleInvoice:[availableOptions=null, balanceAmount=null, customerName=null, handlingStatus=null, invoiceId=null, invoiceNumber=null, selectedOption=null, totalAmount=null, zuoraStatus=null], Invocable_Obj_HandleInvoice:[availableOptions=null, balanceAmount=null, customerName=null, handlingStatus=null, invoiceId=null, invoiceNumber=null, selectedOption=null, totalAmount=null, zuoraStatus=null])
UPDATE***
Used:
var updatedInvoiceList = JSON.stringify(cmp.get('v.handleInvoices'));
Apex
system.debug((List<Invocable_Obj_HandleInvoice>) System.JSON.deserialize(invoices, List<Invocable_Obj_HandleInvoice>.class));
ERROR:
FATAL_ERROR|System.JSONException: Expected Map<String,String> but found [line:1, column:3]