I am trying to pass array of sObject to Apex controller in Lightning but it is not working.
createOwner : function(component, event, helper) {
console.log('$$$$$$Test: '+ component.get("v.ownerList"));
var action = component.get("c.createAdditionalOwner");
action.setParams({
"newOwnerList": component.get("v.ownerList")
});
action.setCallback(this, function(response){
var state = response.getState();
if (component.isValid() && state === "SUCCESS") {
console.log('$$$$$Check: '+ a.getReturnValue());
}
});
$A.enqueueAction(action);
}
newOwnerList is List of Record and this is the parameter used in Apex method. ownerList is Array of Account used in component.
@AuraEnabled
public static String createAdditionalOwner(List<Visit_Owner_Institution__c> newOwnerList){
System.debug('$$$$$Check: '+ newOwnerList);
return 'Success';
}