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:
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!@AuraEnabled
public static void testSomething(String testSome, Map<String, Object> config) {
System.debug(config.get('gateway'));
}
Is there a known issue for this? The workaround works fine, but I'd prefer to pass the complex list instead.