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
siddik s 6siddik s 6 

how to display all custom objects

Best Answer chosen by siddik s 6
FearNoneFearNone
siddik,

you can try this:
for(Schema.SObjectType objTyp : Schema.getGlobalDescribe().Values()){
    if(objTyp.getDescribe().isCustom()){
        System.debug(objTyp.getDescribe().getName());
    }
}

 

All Answers

FearNoneFearNone
siddik,

you can try this:
for(Schema.SObjectType objTyp : Schema.getGlobalDescribe().Values()){
    if(objTyp.getDescribe().isCustom()){
        System.debug(objTyp.getDescribe().getName());
    }
}

 
This was selected as the best answer
siddik s 6siddik s 6
thank you
Anilkumar KotaAnilkumar Kota
You can try the following Code

Vf Page:

<apex:page controller="ObjectSchema">
    <apex:form >
        <apex:pageBlock >
           
            {!AllObjects}<br/>
            
        </apex:pageBlock>      
    </apex:form>
</apex:page>


APex Class:


public Class ObjectSchema{
    public List<String> AllObjects{get;set;}
    Public List<String>objectnames{get;set;}
    
    
   
    
    
    public ObjectSchema(){
    
    system.debug('here');
        AllObjects = New List<string>();
        objectnames = new list<String>();
        
   
          
        Map<String , Schema.SObjectType> globalDescription = Schema.getGlobalDescribe();
        
     
       for(Schema.SObjectType objTyp : Schema.getGlobalDescribe().Values()){
       system.debug(objtyp);
          if(objTyp.getDescribe().isCustom()){
       
       objectnames.add(objtyp.getdescribe().getname());
       for(String str : objectnames){
       
       AllObjects.add(str); 
   
        System.debug(objTyp.getDescribe().getName());
        }
        
    }
}
    }
    
   


}