0

I have requirement to display few related list based on the profile for that i have design the separate page for that.

Below is the apex code to get the Related child names ie.. "relatedListNames".

Schema.DescribeSObjectResult R = <ObjectName>.SObjectType.getDescribe();
    List<Schema.ChildRelationship> relatedLsts= R.getChildRelationships(); 
    relatedListNames=new  Set<String>();
    for( Schema.ChildRelationship childObject :relatedLsts){
        System.debug('childObject *** : '+childObject);
        relatedListNames.add(String.valueOf(childObject.getChildSObject()));
    }

Now i have to display those related names in my visual force page as mentionedin below lines, but i am getting an error "Literal value is required for attribute list in <apex:relatedList> in * at line * column *: Markup" when i try to save the visual force page.

 <apex:repeat value="{!relatedListNames}" var="relatedListName" >
        <apex:relatedList list="{!relatedListName}" /> 
 </apex:repeat>

Can anyone help me with solving , how can i display related list dynamically in visual force page.

0

1 Answer 1

1

You want to display related list dynamically on vf page. For this you have to create a dynamic VF page.

This question has been asked here already:

<apex:relatedList list="{!DontExistInAllOrgs__c}"/ > only solveable with Dynamic Vf components?

0

You must log in to answer this question.

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