Created
November 11, 2014 15:16
-
-
Save sechastain/eaa2996a0a91223931d4 to your computer and use it in GitHub Desktop.
Salesforce Apex List Required Fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SObjectType sot = Your_Custom_Object__c.SObjectType; | |
Map<String, SObjectField> fields = sot.getDescribe().fields.getMap(); | |
for(String k : fields.keyset()) { | |
DescribeFieldResult dfr = fields.get(k).getDescribe(); | |
if(!dfr.isNillable()) { | |
System.debug('REQUIRED FIELD: ' + k); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment