Skip to content

Instantly share code, notes, and snippets.

@nithesh1992
Last active November 27, 2016 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nithesh1992/ad1342b483372c40488426130f8747e8 to your computer and use it in GitHub Desktop.
Save nithesh1992/ad1342b483372c40488426130f8747e8 to your computer and use it in GitHub Desktop.
// SalesForce Apex Code
List<Schema.SObjectType> AllSobjects = Schema.getGlobalDescribe().Values(); // Getting All sObjects available.
List<String> AllSobjectsNames = new List<String>();
for(Schema.SObjectType sObj : AllSobjects) {
AllSobjectsNames.add(sObj.getDescribe().getName());
} // Getting All sObjects Names available.
System.debug(' **Total sObject Count: ' + AllSobjectsNames.size());
SObjectType acc = Schema.getGlobalDescribe().get('Account'); // Account sObject is just hardcoded here..Can use any sObject Name.
Map<String,Schema.SObjectField> allFields = acc.getDescribe().fields.getMap(); //All fields as a map.
System.debug(' **Total field Count: ' + allFields.size());
for(String sfield : allFields.keyset()) {
System.debug('--> '+ allFields.get(sField));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment