Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Map<String,Schema.SObjectType> gd = Schema.getGlobalDescribe();
- Schema.DescribeSObjectResult r = gd.get(':::Put Your Object here:::').getDescribe();
- Map<String,Schema.SObjectField> M = r.fields.getMap();
- for(String fieldName : M.keySet()) {
- Schema.SObjectField field = M.get(fieldName);
- Schema.DescribeFieldResult F = field.getDescribe();
- //A nillable field can have empty content.
- //A isNillable Boolean non-nillable field must have a value for the object to be created or saved.
- // if F.isNillable() is false then field is mandatory
- Boolean isFieldreq = F.isNillable();
- system.debug('field-->'+F.getName()+': isMandatory-->'+!isFieldreq);
- }
Add Comment
Please, Sign In to add comment