How to know salesforce object type from the record Id Prefix?

Published by

on


In salesforce each record of standard or custom object has an unique identifier. If you notice carefully you will see the 1st three digit of all records of each object are same. Like all the contact records are starts with same 1st three digits. This way you can easily identify the object type from the record id.

Commonly used in scenarios where you need to identify if the owner of the record is queue of user. Or common trigger helper class to find if it is invoked from Account record or Contact record, etc.

Below are the list of mostly used standard objects and their corresponding object id prefix.

Standard Object API NameObject Id Prefixes
Account001
Activity007
Approval806
Attachment00P
CampaignMember00v
Campaigns701
Case500
Contact003
Contract800
Dashboard01Z
DashboardComponent01a
EmailTemplate00X
Event00U
Folder00l
Group00G
Page Layout00h
Lead00Q
ListView00B
Opportunity006
OpportunityLineItem00k
Order801
OrderItem802
Pricebook00i
Pricebook201s
Product00j
Product201t
Profile00e
Report00O
Sharing Rule02c
Task00T
User005
UserRole00E