+ Start a Discussion
tanmayeetanmayee 

Apex class to pull the name of all the objects from a salesforce account

I want to write an apex class to pull the name of all the objects (both standard as well as custom) from a salesforce account and display the same in a VF page.  Any help would be highly appreciated.

AdminBoosterAdminBooster

you could start with something like this

 

Map<String, Schema.SObjectType> objList = Schema.getGlobalDescribe();

for (String objName:objList.keyset()){

    //Use the value

    system.debug(objName);

}

Cory CowgillCory Cowgill

You can use the SObject Describe method to do this per AdminBoosters post above.

 

 

I wrote an article about using this with Visualforce a while back as an example. You could reusue some of the code I have there to solve our problem.

http://corycowgill.blogspot.com/2011/01/building-dynamic-soql-select-all-query.html