Wednesday, January 22, 2014

How to get all the fields of sObject using dynamic Apex

How to get all the fields of sObject using dynamic Apex

Map<String, Schema.SObjectType> m  = Schema.getGlobalDescribe() ;
Schema.SObjectType s = m.get('API_Name_Of_SObject') ;
Schema.DescribeSObjectResult r = s.getDescribe() ;
Map<String,Schema.SObjectField> fields = r.fields.getMap() ;


No comments:

Post a Comment