Wednesday, December 3, 2014

How to find object type from Salesforce record id?

How to find object type from Salesforce record id?

Hi,

In some cases you can get the details of the object based  on the record id, in such scenarios we can achive with Dynamic apex using SobjectType class.

in the below code snippet based on account record id it is going to display the object name in debug console.

//0019000001AE8dn is my organization account id.
Id recId = '0019000001AE8dn'; 
Schema.SObjectType objType = recId.getSobjectType();
 System.debug('Object Type is ' + objType);



2 comments:

sandeep saxena said...

Thank you for your so cool post,it is useful,i love it very much.please share with us more good articles.
QTP Training in Chennai
UFT Training in Chennai
Automation testing training in chennai
QTP Training in Velachery
LoadRunner Training in Chennai
Loadrunner course in Chennai
javascript training in chennai
core java training in chennai

nick jones said...

good blog..
Server and Storage Solutions

Post a Comment

 
| ,