+ Start a Discussion

urgent:displaying record types under selected object in vf page

Hi all ,

     i wrote the following class for displaying list of objects in salsforce.


public class objectList{public string pname{set;get;}public string pvalues{set;get;}public String val {get;set;}public List<SelectOption> getName()  {  List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();      List<SelectOption> options = new List<SelectOption>();    for(Schema.SObjectType f : gd)    {    options.add(new SelectOption(f.getDescribe().getLabel(),f.getDescribe().getLabel()));    }   return options;   }


<apex:page controller="objectList" sidebar="false" >  <apex:form >    <apex:SelectList value="{!val}" size="1">     <apex:selectOptions value="{!Name}"></apex:selectOptions>             </apex:SelectList><br/><br/><br/>         </apex:form></apex:page>


in this i want when i select one object. suppose that object contains record types. that record types are also displayed in picklist form under that object.How to add this extended functionality.any one can u please help me and send me the extended code.


thanks in advance.




you can get the record types from the recordType object such as 


[select id,name,sobjectType from recordType where sobjectType='account']


btw, if you use the "Insert Code" button in the text editor, it makes your code easier for others to read.