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

how to list all the available standard objects in my instance
hi,
is there any way to list out all the objects available in a n SF instance?
i'm using JAVA and an enterprise WSDL.
please help to solve this issue.
regards,
MM Praneeth
All Answers
Sfell - any way to do this in apex? describeGlobal() doesn't seem to be supported (lack of metadata API access?)
Error: Compile Error: Invalid type: DescribeGlobalResult at line 128 column 9
End goal - create a picklist of all sObject labels (think data loader picklist).
Yes, i don't remember the exact syntax, check out the section of the apex docs for dynamic apex.
Thanks Simon - I missed that in my first searches and you saved me a lot of time last night!
I need to filter out some types, but the syntax for others:
John and Simon,
Thank you both for posting this response! It saved me a ton of time today.
Sahana
salesforce.com
I get all kinds of junk with GlobalDescribe() - including things such as "Apex Class" and "Apex Debug Log", "Account Share" etc.
I don't see an easy way of filtering out in DescribeSObjectResult methods - I just want the standard objects typically visible in UI and user defined custom objects.
The isSearchable() seems to filter out most of junk, but it filters out some valid objects - e.g OpportunityLineItem
Here's a more complete code snippet of a controller I use for Chatter Unfollow Rules. A couple of properties can greatly shorten the list:
//gd is the global describe
gd.get(objectName).getDescribe().isAccessible()==True
gd.get(objectName).getDescribe().isUpdateable()==True
I then have a "first tier objects" list and a "second tier objects list" and a "never show objects list:
Is there any way to get the object name if selected type is a refrence field in a describe call.
My code is
//To get relationship names from the above list
for(Schema.ChildRelationship relname:lstchildrelationships){
if(relname.getrelationshipname() != null)
ListOfRelatedObjects.add(new SelectOption(string.valueOf(relname.getChildSObject()) ,relname.getrelationshipname()));
}
// This for loop add the field api name as a key and field label as value into field list
for(Schema.SObjectField fieldName:fieldsMap.Values()){
ListOfFields.add(new SelectOption(fieldname.getDescribe().getName(),fieldName.getDescribe().getLabel()));
}
what i want is if type of field is refrence then object name is added in the value section of selectoption list in place of field API.
Any help is appreciated.
Regards,
Faiza