0

I want to pass a list of Orders from the JavaScript Controller into the Apex Controller. When I debug, I get a value for the list of orders in the JavaScript Controller, but the Apex Controller does not receive the parameter. Here is the code:

JavaScript Controller

shiftOrders : function(component, event, helper) {

    var selectedOrders = component.get("v.selectedOrders");
    var selectedOrdersString=JSON.stringify(selectedOrders);
    console.log("selectedOrdersString "+selectedOrdersString);

    var shiftOrders = component.get("c.shiftOrders"); 
    shiftOrders.setParams({
        selectedOrdersString : selectedOrdersString
    });     
    shiftOrders.setCallback(this, function(responseOrders){
        console.log("responseOrders.getReturnValue() "+responseOrders.getReturnValue());
    });       
    $A.enqueueAction(shiftOrders);

}

Apex Controller

@AuraEnabled
public static String shiftOrders(String selectedOrdersString){

    system.debug(logginglevel.debug, 'selectedOrdersString'+selectedOrdersString);

    //List<Order> selectedOrders = (List<Order>)JSON.deserialize(selectedOrdersString, List<Order>.class);      


    return selectedOrdersString;

}

What is the problem?

1 Answer 1

0

I found the issue, the Apex method needs to be a getter Method: getShiftOrders!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .