I am returning a map value from the apex controller, but the helper controller doesn't receive anything data. Here the system.debug outputs the right values to be received by the controller. Plz advise!

public static Map<String,unitDetails> getMdus() {
  Map<String,unitDetails> mdus = new Map<String,unitDetails>();
         //Code that populates the variables here

           unitDetails mdu = new unitDetails();
            mdu.activeUnits = activeUnits;
            mdu.neverUnits = neverUnits;
            mdu.coldUnits = coldUnits;
            mdu.internetOfferings = internetOfferings;
            mdu.videoOfferings = videoOfferings;
            mdu.phoneOfferings = phoneOfferings;
            mdu.singlePlays = singlePlays;
            mdu.doublePlays = doublePlays;
            mdu.triplePlays = triplePlays;

        return mdus;
public class unitDetails {
        public Integer activeUnits {get; set;}
        public Integer neverUnits {get; set;}
        public Integer coldUnits {get; set;}
        public Integer internetOfferings {get; set;}
        public Integer videoOfferings {get; set;}
        public Integer phoneOfferings {get; set;}
        public Integer singlePlays {get; set;}
        public Integer doublePlays {get; set;}
        public Integer triplePlays {get; set;}
  • What's the context here? Lightning? Visualforce? Something else?
    – sfdcfox
    Feb 8 '19 at 5:00
  • @sfdcfox - Lightning
    – sumchans
    Feb 8 '19 at 5:00

In Lightning, you must use @AuraEnabled in order to have the data be serialized.

public class unitDetails {
    @AuraEnabled public Integer activeUnits;
    @AuraEnabled public Integer neverUnits;
    @AuraEnabled public Integer coldUnits;
    @AuraEnabled public Integer internetOfferings;
    @AuraEnabled public Integer videoOfferings;
    @AuraEnabled public Integer phoneOfferings;
    @AuraEnabled public Integer singlePlays;
    @AuraEnabled public Integer doublePlays;
    @AuraEnabled public Integer triplePlays;
  • @Sumchans You're welcome!
    – sfdcfox
    Feb 8 '19 at 5:08

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.