2

I have an apex class as below with a wrapper:

public class lightningController{
    public class ContactWrappertest{
    @AuraEnabled
    public boolean checked {get; set;}
    @AuraEnabled
    public Contact cont {get; set;}

    public ContactWrappertest(Boolean isChecked, Contact c){
        this.checked = isChecked;
        this.cont = c;
    }
}

Now when i try to create a lightning component attribute as below and save it:

<aura:component controller="lightningController" implements="force:appHostable" access="global">
    <aura:attribute name="weekWrapList" type= "lightningController.ContactWrappertest[]"/>
 </aura:component>

I get below error on Save: Failed to save lightningComponent.cmp: Invalid type: ContactWrappertest[]: Source

Can someone help me understand the issue here and try to resolve it?

1 Answer 1

1

This just started happening from latest spring 18 release or API version 42.0 I believe.

The way I resolved was to not use an inner class and instead have the inner class as its own class and then the below should save.

In your case create a class called ContactWrappertest as a separate class .

<aura:component controller="lightningController" implements="force:appHostable" access="global">
 <aura:attribute name="weekWrapList" type= "ContactWrappertest[]"/>
</aura:component 
3
  • thanks for quick response. Does this mean, if we have multipe inner wrappers to handle complex logic than for that each wrapper we need to create a seperate class?
    – Shrey
    Commented Feb 13, 2018 at 22:41
  • I would create them as separate classes .Did not get by complex logic ? Logic would remain on the parent class ,we are taking the inner classes out to its own class . Commented Feb 13, 2018 at 22:45
  • salesforce.stackexchange.com/questions/203955/…. check this out seems it was never meant to work .seems like a bug that they fixed
    – RedDevil
    Commented Feb 15, 2018 at 12:46

You must log in to answer this question.

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