controller
public class objectLists{
public String SeletedObject {get; set;}
public String childObj {get;set;}
List<SelectOption> options;
public List<SelectOption> getObjectOptions()
{
options = new List<SelectOption>();
Map<String, Schema.SObjectType> AllObjmap = New Map<String, Schema.SObjectType>();
AllObjmap = Schema.getGlobalDescribe();
System.debug('******All object Names******* :'+ AllObjmap.keyset());
for(String ObjectName: AllObjmap.keySet())
{
List<string> objlist = new List<string>();
objlist.add(ObjectName);
options.add(new SelectOption(ObjectName,ObjectName));
}
return options;
}
public void getrelatedchild()
{
Map<string,string> childMap = new Map<String, String>();
List<Schema.Childrelationship> childList = Schema.getGlobalDescribe().get(SeletedObject).getdescribe().getChildRelationships();
}
}
vf page
<apex:page controller="objectLists" >
<apex:form >
<apex:pageBlock title="Select Object">
<apex:actionFunction name="getchild" action="{!getrelatedchild}" oncomplete="alert('compeleted')" />
<apex:outputPanel >Object:</apex:outputPanel>
<apex:selectList size="1" value="{!SeletedObject}" onchange="callchild();">
<apex:selectOptions value="{!ObjectOptions}" />
</apex:selectList>
<apex:pageBlockTable value="{!childObj}" columns="2" var="item" id="a">
</apex:pageBlockTable>
</apex:pageblock>
</apex:form>
</apex:page>
I'm creating picklist of Standard and custom objects, after selecting specific object I want to display related records to that object in pageblocktable. I'm able to add the objects in picklist but unable to disply related records in pageblocktable