Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. String type='Account'; // to make it dynamic. you can send this value in initial of method
  2.  
  3. Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
  4. Schema.SObjectType leadSchema = schemaMap.get(type);
  5. Map<String, Schema.SObjectField> fieldMap = leadSchema.getDescribe().fields.getMap();
  6.  
  7. for (String fieldName: fieldMap.keySet()) {
  8. System.debug('##Field API Name='+fieldName);// list of all field API name
  9. System.debug(fieldMap.get(fieldName).getDescribe().getLabel());//It provides to get the object fields label.
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement