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.