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
Id accountId = '0019000001ryzZP';
String objectName = accountId.getSObjectType().getDescribe().getName();
system.debug('Object Name:'+objectName);
Output: Object Name: Account
No comments:
Post a Comment