Another Salesforce blog!!!

Salesforce, Apex

get all the fields of sObject using dynamic Apex


Map<String, Schema.SObjectType> m  = Schema.getGlobalDescribe();
Schema.SObjectType s = m.get('Speaker__c') ;
Schema.DescribeSObjectResult r = s.getDescribe() ;
Map<String,Schema.SObjectField> fields = r.fields.getMap() ;    
system.debug('///' +fields ); 

Leave a Reply

Your email address will not be published. Required fields are marked *

*