function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
milan mohantymilan mohanty 

how to create a pick list of record types in vf page?

I want to create a pick list of record types (account record types)  on a visual force page, and then which record type I choose that record type I want to show in that visual foce page. How do I do it please need the solution. Thank you.
Jen BennettJen Bennett
/**@var List<RecordType> record types available to return*/
	    List<RecordType> recordTypes = new List<RecordType>();
	    
	    /**@var List<RecrodTypeInfo> describes the recordtype for the object.*/
	    List<RecordTypeInfo> infos = objectType.getDescribe().getRecordTypeInfos();
	    
	    if (infos.size() > 1) {
	        for (RecordTypeInfo info : infos) {
	           if (info.isAvailable() 
	            && !String.valueOf(info.getRecordTypeId()).endsWith(MASTER_RECORD_ID)) { // Ignore the Master Record Type, should not be available with custom record types.
	                recordTypes.add(new RecordType (Id = info.getRecordTypeId(), Name = info.getName()));
	            }
	        }
	    } else {
	    	recordTypes.add(new RecordType (Id = infos[0].getRecordTypeId(), Name = infos[0].getName()));
	    }
The above will get you a list of available record types.