Adminstrator · Apex · Salesforce

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.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s