You need to sign in to do that
Don't have an account?

about schemaprogramng not executing
i need to fetch the objects by using selected list it will shows related child objects
how we do
public class schemaprograming {
public list<selectoption> cobj {set;get;}
public string name1{set;get;}
public list<string> field{set;get;}
public list<selectoption> opt{set;get;}
public sobject myobject{set;get;}
public schemaprograming(){
field=new list<string>();
opt=new list<selectoption>();
map<string,schema.SObjectType> myobj=schema.getGlobalDescribe();
set<string> keys=myobj.keySet();
list<string> order =new list<string>();
order.addAll(keys);
order.sort();
for(string a:order){
selectoption s =new selectoption(a,a);
opt.add(s);
Schema.DescribeSObjectResult child= myobject.sobjecttype.getdescribe();
list<schema.ChildRelationship> R = child.getchildrelationships();
for(schema.ChildRelationship p :R){
cobj=new list<selectoption>();
string name1 =''+p.getChildsobject();
selectoption c1 =new selectoption(name1,name1);
cobj.add(c1);
}
}
}
}
------------------vf page -----------------------------------------------
<apex:page controller="schemaprograming" readOnly="true">
<apex:form >
<apex:pageMessage severity="champakmala" />
<apex:pageBlock title="standard and custem objects">
<apex:pageBlockSection >
<apex:selectList value="{!myobject}" size="1" >
<apex:actionSupport event="onchang" reRender="cod" />
<apex:outputLabel value="objects"/>
<apex:selectOptions value="{!opt}"/>
</apex:selectList>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:pageBlock title="child objects" id="cod">
<apex:selectList size="6" value="{!field}">
<apex:selectOptions value="{!cobj}"/>
</apex:selectList>
</apex:pageBlock>
</apex:form>
</apex:page>