Play Games

Search This Blog

Saturday, November 4, 2017

How to get name of an object based on id of the record in salesforce

Solution: we can use getSObjectType().getDescribe().getName() to get object name.
Id accountId = '0019000001ryzZP';
String objectName = accountId.getSObjectType().getDescribe().getName();
system.debug('Object Name:'+objectName);

Output: Object Name: Account

No comments:

Post a Comment