function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tim__mTim__m 

Standard Set Controller and Child Relationships

How do I work with child relationships in a standard set controller with dynamic visualforce? Here is what I was trying to do. This is not a working example (it throws a system.security.NoAccessException: Object type not accessible. error) but I was hopping I was close to what needs to be done. I know I can write apex to get what I need with the child relationship but I'm trying to use the native power of visualforce. 


 

<<< The Page >>>
<apex:page standardController="myObj__c" extensions="myObjExtension" recordSetvar="myObj">
...
<apex:listViews type="myObj__c">
    <apex:facet name="body">
        <apex:outputPanel>
            <apex:repeat value="{!MySetController.Records}" var="pv">
                <apex:outputLabel value="{!pv['name']}" />
                ...
                <apex:repeat value="{!pv['Relationship__r']}" var="cv">
                    <apex:outputLabel value="{!cv['foo']}" />
                    ...
                </apex:repeat>
            </apex:repeat>
        </apex:outputPanel>
    </apex:facet>
</apex:listViews>
...


<<< The Extension >>>
public class myExtension {

    public ApexPages.StandardSetController mySetController { get; set; }
	
    public myExtension(ApexPages.StandardSetController controller) { 
	mySetController = controller;
	mySetController.addFields(new String[{'name','Relationship__r.foo'});
	...	
    }
}

 

Any thoughts or opinions would help.

 

kiranmutturukiranmutturu
<apex:page standardController="Case">
<apex:sectionHeader title="http://www.salesforce.com" subtitle="Related List Example"/>
<apex:pageBlock> 
<apex:pageBlockTable value="{!Case.Childs__r}" var="child">
    <apex:column headervalue="Name"><apex:outputLink value="/{!child.id}">{!child.name}</apex:outputLink></apex:column>
    <apex:column value="{!child.detail__c}"/>
    <apex:column value="{!child.is_active__c}"/>
    <apex:column value="{!child.createddate}"/>
    <apex:column value="{!child.createdbyId}"/>
</apex:pageBlockTable> 
</apex:pageBlock>
</apex:page>
Tim__mTim__m

Kiran, your example is not dynamic nor is it using a standard set controller. Thanks anyhow.

 

Anyone else?