11

I have found an issue that when calling an Apex method from Lightning that returns a class that extends an abstract class, then only the @AuraEnabled getters from the concrete class are returned, the getters from the base abstract class are not.

BaseThing

public abstract class BaseThing {

    @AuraEnabled
    public String getOne() {
        return '1';
    }

    @AuraEnabled
    public String getTwo() {
        return '2';
    }

}

ConcreteThing

public class ConcreteThing extends BaseThing {

    @AuraEnabled
    public String getThree() {
        return '3';
    }

    @AuraEnabled
    public String getFour() {
        return '4';
    }

}

NumberController

public class NumberController {

    @AuraEnabled
    public static ConcreteThing GetConcreteThing()
    {
        return new ConcreteThing();
    }

}

As you can see from the screenshot of the Lightning Inspector, when this Apex action is called only the getters from the concrete class are returned:

View of action from Lightning Inspector

Is this supposed to be supported, or is this a bug? I can't see anywhere in the Lightning documentation that states that this isn't supported.

Mark Keats
  • 1,929
  • 12
  • 23

1 Answers1

6

I have had a response from the product manager at Salesforce that this is indeed a bug. It is logged as W-3176751, although it doesn't seem to appear on the known issues site at the moment.

I am awaiting a response regarding it's public visibility on the Known Issues site and the expected fix date.

Mark Keats
  • 1,929
  • 12
  • 23
  • After six months, I faced the issue yesterday. Is there maybe an update by now? – Christian Szandor Knapp Jan 20 '17 at 09:33
  • It is still not working. Btw, you can use JSON to serialize/deresialize between controllers if you don't have cycles. – Oles Malkov Apr 24 '17 at 10:12
  • 2
    still seeing this issue as of Late October 2017. Apparently it's a bug that no one's in a hurry to fix. – Jason Benkert Oct 26 '17 at 17:41
  • It looks like they may be attempting to fix this in Spring 18 but in the process have introduced a huge issue detailed here: https://salesforce.stackexchange.com/questions/205012/spring-18-breaks-overridden-apex-methods-in-lightning-components – dsharrison Jan 18 '18 at 20:41