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.

  • 1
    Sounds like a bug to me ! – Mohith Shrivastava May 27 '16 at 16:34
  • I have added a post to the Salesforce Success sitea success.salesforce.com/0D53A00002j36DX -- If I don't get a response there I shall open a case with Salesforce. – Mark Keats May 31 '16 at 8:25
  • 1
    Just ran into it myself - in my case I was using a virtual class, with the exact same effect. – Caspar Harmer Dec 1 '16 at 3:08
  • Workaround: serialize in Apex controller and parse in Lightning. – Christian Szandor Knapp Jan 20 '17 at 9:36
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.

| improve this answer | |
  • After six months, I faced the issue yesterday. Is there maybe an update by now? – Christian Szandor Knapp Jan 20 '17 at 9: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: salesforce.stackexchange.com/questions/205012/… – dsharrison Jan 18 '18 at 20:41

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.