4

My requirement is how to get the object name using Object ID. First 3 places of the record Id depends on Object name. Is there any method to getting the Object name to pass the record Id...?? If anyone knows update.

12

Use Following method to get the SObjectType

Id someId = '00590000000eF8z';
System.debug(someId.getSObjectType());

Output :

User

0
0

GET OBJECT NAME FROM RECORD ID? String sObjName = myRecordId.getSObjectType().getDescribe().getName();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.