Last active
June 6, 2017 03:32
-
-
Save alex-shekhter/83ee08961bb293728d55275fd05d5546 to your computer and use it in GitHub Desktop.
Get all SObject's prefixes in the Salesforce ORG. Better to be used like a SysAdmin.
This file contains hidden or 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
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe(); | |
Map<String,String> objNameToPrefix = new Map<String,String>(); | |
for ( Schema.SObjectType ot : gd.values() ) { | |
Schema.DescribeSObjectResult dor = ot.getDescribe(); | |
objNameToPrefix.put( dor.getName(), dor.getKeyPrefix() ); | |
} | |
System.debug( '--->>> ' + objNameToPrefix ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment