Skip to main content Dedicaci 5 minuti per partecipare al sondaggio della nostra community. Aperto da oggi fino al giorno 11/4/2025. Fai clic qui per partecipare.
Charles Naccio ha fatto una domanda in #Lightning Experience
Objects with a single layer work fine, but when I try to use an object that goes deeper than one layer I receive an unknown server error when trying to access the variable on the server side user parameter.get('objectPropertyName') see code below.

So this code works as gateway is a simple string. However whenever I try to make gateway an object I start getting errors

/*******************************************************************************************************

* @description Test saving configuration

*/

var saveConfiguration = component.get("c.testSomething");

// Set save configuration parameters.

saveConfiguration.setParams({

testSome : 'Hello World!',

config : {

gateway: 'Stripe'

}

});

// Setup save configuration callback

saveConfiguration.setCallback(this, function(a) {

if (a.getState() === "SUCCESS") {

// Do something with return value

} else if (a.getState() === "ERROR") {

$A.error("Errors", a.getError());

$A.log("Errors", a.getError());

}

});

// Queue the transaction action

$A.enqueueAction(saveConfiguration);

This code gives me an error when trying to access the parameter map in the server side controller. 

/*******************************************************************************************************

* @description Test saving configuration

*/

var saveConfiguration = component.get("c.testSomething");

// Set save configuration parameters.

saveConfiguration.setParams({

testSome : 'Hello World!',

config : {

gateway: 'Stripe'

}

});

// Setup save configuration callback

saveConfiguration.setCallback(this, function(a) {

if (a.getState() === "SUCCESS") {

// Do something with return value

} else if (a.getState() === "ERROR") {

$A.error("Errors", a.getError());

$A.log("Errors", a.getError());

}

});

// Queue the transaction action

$A.enqueueAction(saveConfiguration);

Here's my server side controller method:

@AuraEnabled

public static void testSomething(String testSome, Map<String, Object> config) {

System.debug(config.get('gateway'));

}

So in summary whenever gateway is a simple string everything works... The second I try to use an object I start getting errors. I'd prefer to use one of my Apex classes instead of a Map<String, Object> for the parameter, but I was having no luck with that. Any help is much appreciated!

 
9 risposte
  1. 26 giu 2018, 17:32
    Is there a known issue for this? The workaround works fine, but I'd prefer to pass the complex list instead.
Caricamento in corso
0/9000