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

List of all the objects in the org.
Hi everyone,
Is there a way to get an list of all the objects in the development org.? I have tried using a schema method as below,
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
But I can only obtain a Map of sObjectType.
Thanks.
Thank you very much Ankit,
I think, I havent asked the question properly. What I actually needed was a Map of sObject s. :)
But I went through your blog and came up with an answer. I will post that for the sake of competion of this thread.
public Map<String,sObject> getSobjects()
{
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
Map<String, sObject> sObjects=new Map<String,sObject>();
Set<String> keys=new Set<String>();
keys=gd.keySet();
for(String key:keys)
{
sObject sObj = Schema.getGlobalDescribe().get(key).newSObject() ;
sObjects.put(key,sObj);
}
return sObjects;
}
Thanks again Ankit.
All Answers
Here is the code :
Thanks
Ankit Arora
Blog | Facebook | Blog Page
Thank you very much Ankit,
I think, I havent asked the question properly. What I actually needed was a Map of sObject s. :)
But I went through your blog and came up with an answer. I will post that for the sake of competion of this thread.
public Map<String,sObject> getSobjects()
{
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
Map<String, sObject> sObjects=new Map<String,sObject>();
Set<String> keys=new Set<String>();
keys=gd.keySet();
for(String key:keys)
{
sObject sObj = Schema.getGlobalDescribe().get(key).newSObject() ;
sObjects.put(key,sObj);
}
return sObjects;
}
Thanks again Ankit.