Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String type='Account'; // to make it dynamic. you can send this value in initial of method
- Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
- Schema.SObjectType leadSchema = schemaMap.get(type);
- Map<String, Schema.SObjectField> fieldMap = leadSchema.getDescribe().fields.getMap();
- for (String fieldName: fieldMap.keySet()) {
- System.debug('##Field API Name='+fieldName);// list of all field API name
- System.debug(fieldMap.get(fieldName).getDescribe().getLabel());//It provides to get the object fields label.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement