Activity Forums Salesforce® Discussions How to get the list of all available sobject in salesforce database using Apex (Dynamic Apex) ?

  • Manpreet

    Member
    May 9, 2017 at 1:02 pm

    Hi saurabh,

    You can do this by using  Schema.getGlobalDescribe , something like this :
    Map<String, Schema.SObjectType> m = Schema.getGlobalDescribe() ;
    system.debug('///' + m );

    Thanks.

  • Parul

    Member
    September 20, 2018 at 5:56 pm

    public class ControllerClassName
    {
    public List<String> strList { get;set; }

    public void autoRun()
    {
    Map<String, Schema.SObjectField> objectFields = Schema.getGlobalDescribe().get('Account').getDescribe().fields.getMap();

    strList = new List<String>(objectFields.keySet());

    }
    }

     

    Try this

     

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos