How to Find Salesforce Object Id (Custom / Standard)



In salesforce every object has unique Id. first three digit called Object Id.

Example :
Account - 001, Contact -003, Opportunity -006

Note :Custom Object Id change in production so don't  hardcode Object Id in code.

how you get through code

// At place Objectname__c use- object API Name
system.debug('ObjectId ==>'+ Objectname__c.sobjecttype.getDescribe().getKeyPrefix());


open developer console and debug





Thanks Cheers!


0 comments:

Post a Comment