You need to sign in to do that
Don't have an account?
Peace
Fetch few standard objects
Hi,
I am new to Salesforce. I have a doubt..
Can we fetch only those standard objects which are usually displayed as tabs on home page such as Campaigns, Leads, Contacts, Accounts, Opportunities, Forecasts, etc. Without hardcoding names of the object in Code.
Is it possible?
Please help
http://www.salesforce.com/us/developer/docs/soql_sosl/index.htm
Thanks for ur reply..
So if i want to fetch only those standard objects which are present under Customize tab (Name -> Setup -> Customize)
ie. excluding all the objects mentioned in the last NOTE in the following link:
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_list.htm
Is it possible to fetch such objects (objects under customize tab) by modifying below code ?
Below code returns all standard objects.
OR, following are the only two solutions ??
1. Using object names on SOQL
2. Harcoding object names in code as below:
Set<String> stdObjectSet = new Set<String>{'Account','Contact','Lead'}; // Names of objects under Customize tab
for ( Schema.SObjectType f : Schema.getGlobalDescribe().values()){
if ( stdObjectSet.contains(f.getDescribe().getName()) ){
options1.add(new SelectOption(f.getDescribe().getName(),f.getDescribe().getLabel()));
}
}
So the options you mentioned are correct.
However, instead of hardcoding the values in code. you may want to define a custom setting a store the object names there and then use it in your code.
thanks Rahul,
Can u please explain with an example.
ie. How to implement a custom setting to store the object names and how to use it in my code.
Please help