Welcome to my blog

I have been working with Salesforce for quite a while, so don’t hesitate to contact me if you have any questions or want some advice.

s f

Subscribe
Follow Us
h

How to find list of custom object prefix decoder in your org?

 . Adminstrator  . How to find list of custom object prefix decoder in your org?

How to find list of custom object prefix decoder in your org?

Learn How to Find List of Custom Object Prefix Decoder in Your org

Please run below script in your developer console

Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
for(String str : gd.keySet()) {
    Schema.SObjectType obj = gd.get(str);
    Schema.DescribeSObjectResult objResult = obj.getDescribe();
    if(objResult.isCustom() == True) {
        system.debug('Object name: '+ str + ' - Prefix Code :' +objResult.getKeyPrefix());
    }
}

You can add additional logic to insert/update the object name and prefix in custom object/custom settings.

Post a Comment