Monday, November 19, 2018

How to get Salesforce Object key prefix

if we look at the Salesforce record Id, we can observe
001G000001umxxX
001 ----------->  Object ID Prefix
G0 ------------>  Server-Id
00001umxxX -------->  Identifier

If you want to get any Salesforce object key prefix use below code
String strObjPrefix = Account.sObjecttype.getDescribe().getKeyPrefix();
System.debug('OBJ prefix ====> '+strObjPrefix);
Let us know if you any queries
Happy Learning!!!

No comments:

Post a Comment