You need to sign in to do that
Don't have an account?

Error using inner class in component attribute
I'd like to pass an Apex class that I've defined as a public inner class to a Visualforce component. When I try to save the component, I get these errors:
Error: Unsupported type SimpleOuter.SimpleInner[] encountered.
Error: Apex class 'simpleouter.simpleinner' does not exist.
Here's my sample code:
public with sharing class SimpleOuter {
public class SimpleInner {
public String one;
public String two;
}
}
<apex:component>
<apex:attribute name="phoneStatuses" type="SimpleOuter.SimpleInner[]" required="true"
description="The phone numbers and statuses to display." />
</apex:component>
Any ideas?
I hit exactly the same problem about a month ago. I couldn't find a solution - the notation looks correct and can be used that way in Apex, but doesn't seem to work when used as an attribute. It seems that you can use standard classes in this way (I've passed ApexPages.Action attributes) but not your custom classes.
I ended up refactoring my inner class into a top level class.
I work around this by making the inner class a top level class but Salesforce support suggested this, not sure if it works and I don't have test at the moment.
This is Suresh from salesforce.com developer support, it's regarding your open case 03173111.
Can you please try this code
<apex:component >
<apex:attribute type="Attributeable[]" name="TruckAttribute" description="attribute for a truck" />
</apex:component>
public interface Attributeable {
// empty interface to allow for using inner class as component attributes.
}
public class Vehicle {
public class Truck implements Attributeable {
public String make;
}
}
Let me know if you have any issues on this.
Thanks & Regards
Suresh Uppala
Developer Support Engineer
ref:00D062.50037DaTo:ref
I ran into the same exact issue. Looks like it's time to hit up IdeaExchange.
This seems like a bug that needs to be fixed rather than an idea for a new feature.
Depends on what the documenation says. If it says ihat this should work, it's a bug. Otherwise, it's an idea.
I tested the solution provided to cmarz_1 from Salesforce support, and it works. But I must say it's a bit cumbersome.