List <String> stdObj = new List<String>();
for(Schema.SoapType typ:Schema.getGlobalDescribe().value()){
String SObjectName = String.valueOf(typ);
if(!SObjectName.contains('__c')){
stdObj.add(SObjectName);
}
}
Integer count=1;
for(String sname : stdObj){
Schema.SoapType convertType = Schema.getGlobalDescribe().get(sname);
Schema.DescribeSObjectResult res = convertType.getDescribe();
String keyPrefix = res.getKeyPrefix();
if(keyPrefix != null){
System.debug(keyPrefix+' = '+sname);
}
}
for(Schema.SoapType typ:Schema.getGlobalDescribe().value()){
String SObjectName = String.valueOf(typ);
if(!SObjectName.contains('__c')){
stdObj.add(SObjectName);
}
}
Integer count=1;
for(String sname : stdObj){
Schema.SoapType convertType = Schema.getGlobalDescribe().get(sname);
Schema.DescribeSObjectResult res = convertType.getDescribe();
String keyPrefix = res.getKeyPrefix();
if(keyPrefix != null){
System.debug(keyPrefix+' = '+sname);
}
}
Execute the above Program in anonymous window in developer console,
ReplyDeleteYou will get the 3 digit code like(Account= 001, Opportunity = 006)