1
public virtual class TopLevel {

    @AuraEnabled
    public virtual void getwriter() {
        System.debug('At top level');
    }

    public class lowerLevel extends TopLevel {

        @AuraEnabled
        public override void getwriter() {
            System.debug('Within lowerLevel.writer.');
        }
}

I'm trying to call lowerLevel from within my javascript code as such

var action = component.get('c.lowerLevel.writer');
action.setCallback(this, function(ret) {});
$A.enqueueAction(action);

But I'm getting the error of

Uncaught Unknown controller action 'lowerLevel.writer'

It makes sense to me that it should work since the TopLevel is implied (as we can call

var action = component.get('c.writer');

and in the system debug we'll find "At top level"

My lightning component is defined as such

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" controller="TopLevel">

Anyone know how I can make it do what I want?

  • I'm pretty sure this isn't actually "allowed", despite the compiler allowing the annotation. – sfdcfox Sep 26 '17 at 17:43
  • Can you point me in the right direction to doing what I want then? – user49458 Sep 26 '17 at 17:58
  • Isn't this a case of salesforce.stackexchange.com/questions/123744/… ? – Christian Szandor Knapp Sep 26 '17 at 19:23
  • Seems like it. Also, silly question but if I create a subclass should it go into the same file as the main class or in a new file? Or will it not make a difference? – user49458 Sep 26 '17 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.