0

I have a namespace issue - at least that's what I think it is.

I have a basic simple Apex Class with the following definition:

public with sharing class TestSub {
 public class SubOne {
 @AuraEnabled public string name;
 }
}

Now in my lightning component (TestComp.cmp) I have the following code:

<aura:component>
  <!-- This works -->
 <aura:attribute name="works" type="TestSub" />

 <!-- This doesn't --> 
 <aura:attribute name="wontWork" type="TestSub.SubOne" />

</aura:component>

So the above doesn't work in my org (with a namespace) and it works in my org without a namespace.

I've tried prefixing with the namespace but it doesn't seem to make a difference. Namely:

<aura:attribute name="wontWork" type="MyNamespace.TestSub.SubOne" />

Am I missing something? Do I need to make the class global?

2
  • Hey I was just playing around with your example. <aura:attribute name="wontWork" type="TestSub.SubOne.name" /> works perfectly fine. I don't think its namespace issue since it can resolve an attribute hidden under two levels. Feb 9, 2016 at 20:41
  • Does your org have a namespace? As I have indicated - I have two orgs and in one of them (with out a namespace) it works. But in the org with the namespace it doesn't work.
    – Patrick
    Feb 10, 2016 at 0:48

1 Answer 1

1

I just talked to SF support and unfortunately, subclasses are not supported in when working with namespaces. I believe this is in their road map but not scheduled yet.

A couple of work arounds (there might be others):

  1. Obviously you can create new class files for each sub class
  2. For me, I just reference the attributes as a generic "Object" type - this may or may not work for you.

You must log in to answer this question.

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