function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfg1sfg1 

how to retrieve list of standard objects used in my organization?

how to retrieve list of standard objects used in my organization, is their any way? please guide me.
Best Answer chosen by sfg1
sfg1sfg1
Thanks for your reply Anilkumar,
I have used below code it worked.
Map<string,Schema.sObjectType> AllObjMap = new Map<string,Schema.sObjectType>();
 AllObjMap = Schema.getGlobalDescribe();
for(string s : AllObjMap.keyset() ){
if(!s.contains('__')){
  System.debug('------------>'+s);
}
}

All Answers

sfg1sfg1
Thanks for your reply Anilkumar,
I have used below code it worked.
Map<string,Schema.sObjectType> AllObjMap = new Map<string,Schema.sObjectType>();
 AllObjMap = Schema.getGlobalDescribe();
for(string s : AllObjMap.keyset() ){
if(!s.contains('__')){
  System.debug('------------>'+s);
}
}
This was selected as the best answer
Roshni RahulRoshni Rahul
Hi Dhana,

Please check the code below ,

VisualForce page
<apex:page controller="ObjectRetrieve">
<apex:form >
<apex:outputlabel value="All Standard Objects"/>&nbsp;&nbsp;
<apex:selectList size="1">
<apex:selectoptions value="{!objnames}"></apex:selectoptions>
</apex:selectList>
</apex:form>
</apex:page>

Apex Controller for Visualforce page
 
public class ObjectRetrieve {
public List<SelectOption> getobjNames()
{
List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('--None','--None--'));
for(Schema.SObjectType f : gd)
{
if(!f.getDescribe().getName().contains('__'))
options.add(new SelectOption(f.getDescribe().getName(),f.getDescribe().getName()));
}
return options;
}
}

Hope it helps.

Regards,
Roshni