You need to sign in to do that
Don't have an account?
Anuj.Shukla
List of objects and list of fields of an object
Hi All,
I have following requirements:
>>I have to show a dropdown which should list all the custom objects as well as all the customizable standard objects (non customizable objects should be excluded).
>>I also need to write a method which would return me list of fields for the object name I pass to this method.
Can somebody help me with these two solutions?
Thanks,
Anuj
To get all objects in an org,
Map<String, Schema.SobjectType> allObjects = Schema.getGlobalDescribe();
To get fields of a particular object,
for(Schema.SobjectType sObjectSelected: allObjects.values())
{
Schema.DescribeSObjectResult objectResult = sObjectSelected.getDescribe() ;