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.

4
  • 1
    Sounds like a bug to me ! May 27, 2016 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, 2016 at 8:25
  • 1
    Just ran into it myself - in my case I was using a virtual class, with the exact same effect. Dec 1, 2016 at 3:08
  • Workaround: serialize in Apex controller and parse in Lightning. Jan 20, 2017 at 9:36

1 Answer 1

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.

4
  • After six months, I faced the issue yesterday. Is there maybe an update by now? Jan 20, 2017 at 9:33
  • It is still not working. Btw, you can use JSON to serialize/deresialize between controllers if you don't have cycles. Apr 24, 2017 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. Oct 26, 2017 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, 2018 at 20:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .