2

I have an @AuraEnabled method that has an enum as a parameter. How do I pass this in from a Lightning component?

Component code:

var action2 = component.get("c.doSomething");
action2.setParams({
    name: ??????
});
action2.setCallback(this, function(response){
    var test = response.getReturnValue();
});
$A.enqueueAction(action2);

Controller:

@AuraEnabled
public static String doSomething(Person name){
    return 'Did this work?';
}

public enum Person{ADAM, BOB, CLARISSA, DAVID, ED, FELICIA}

I have tried several things, but either I get a javascript error, or the method returns null.

  • I believe you'll have to pass a string and then convert. – Adrian Larson Feb 5 '19 at 18:14
  • The linked question is a workaround; the way I believe it should work is currently throwing a "gack" ("An internal server error has occurred Error ID: 2132073340-39340 (-2040184674)"), which makes me think that at least someone knows about it. – sfdcfox Feb 5 '19 at 18:23