4

I get a strange error message stating:

Compilation error: Wrong type for attribute <c:sobjecttable displayed="{!$ObjectType.UP2GO_2F__PriceSchedule__c.FieldSets.DisplayedOnDliEdit}">. Expected FieldSet, found FieldSetMember

when i try to use this custom VF component

<apex:component controller="TableCtrl" selfClosing="true" layout="block">
        <apex:attribute name="displayed" type="Schema.FieldSet" assignTo="{!displayedFields}" required="true" description="" /> 

        <apex:pageBlockSection>
         ....

in a VF page like that

    <c:sobjectTable records="priceSchedules" 
                    displayed="{!$ObjectType.Part__c.FieldSets.MyFields}" />              
</apex:pageBlock>
</apex:form>

I know for sure that MyFields is a FieldSet. You cannot even reference FieldSetMembers in VF pages. So this error message does not make any sense to me.

1 Answer 1

4

Got it! At least in parts....

Expression of this type

{!$ObjectType.Object__c.FieldSets.SetName}

in Visualforce evaluate to Schema.FielSetMember[] and not FieldSet. So when i changed my component attribute to

<apex:attribute name="displayed" type="Schema.FieldSetMember[]" assignTo="{!displayedFields} ../>

everything the page compiles.

But it never loads, as Salesforce seems to be unable to pass the array to the assigned controller variable. The page only render the error**

Cannot convert the value of '{!displayedFields}' to the expected type.

So I would answer my own question with: No, it is not possible to pass FieldSet information into Visualforce components.

You must log in to answer this question.

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