Activity Forums Salesforce® Discussions How to retrieve a list of objects?

  • Ravi

    Member
    April 25, 2016 at 8:57 am

    Apex has a class called Schema. It contains the entire schema of your organization. Objects, their fields, field type etc. can all be retrieved using this class.

    List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();

  • sakshi

    Member
    September 30, 2022 at 4:36 am

    To retrieve the list of objects, one needs to create a list of Entity :1. Create an empty list called the results list.2. Loop through the items in the Entity B list.3. For each item in the list, retrieve Entity A from the associated table.4. Add the results of the retrieve to the results list. Also if you are looking for an option to handle errors in Salesforce, do check this blog

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos