Activity Forums Salesforce® Discussions How to get all the required fields of sObject dynamically in Apex?

  • How to get all the required fields of sObject dynamically in Apex?

    Posted by Anuj on September 17, 2020 at 12:39 pm

    How to get all the required fields of sObject dynamically in Apex?

    Anjali replied 3 years, 7 months ago 2 Members · 1 Reply
  • 1 Reply
  • Anjali

    Member
    September 17, 2020 at 1:52 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());}}

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos