The Force.com platform uses two different types of record IDs to identify each record. When we open a record in Salesforce, it uses a 15-character ID; however, when we extract the data from the backend, it uses an 18-character ID.
The 15-character ID is case-sensitive, while the 18-character ID is not case-sensitive. The 18-character ID is used to migrate data from legacy systems or spreadsheets that do not recognize case-sensitive IDs. Functions such as VLOOKUP in Excel do not recognize case-sensitive IDs, and hence, there is a risk of data corruption. Therefore, we use the case-insensitive 18-character ID.
The record ID can be obtained using any one of the following three methods:
CASESAFEID()
function to get the 18-character IDThe easiest way to obtain the record ID is to fetch it from the URL. Whenever we open the Detail page of a record, we can see the ID of the record.
Let's take a look at the Record ID of the opportunity object. The URL of the detail page of the opportunity object is shown in the following screenshot:
The instance name is the server on which the organization resides. Salesforce is a multi-tenant environment, and so, multiple companies or orgs are hosted in the same instance. The record ID is unique for every record in the organization.
The record ID in the Salesforce organization is case sensitive. So, 00690000003zRfq
is not equal to 00690000003ZRFQ
. Further, the record ID comprises two parts, as shown in the following screenshot:
The first three characters of the record ID are the object identifiers, while the remaining characters identify the record. The following table shows us the three character prefixes and the objects that they are associated with:
Prefix |
Object Name |
---|---|
001 |
Account |
003 |
Contact |
005 |
User |
006 |
Opportunity |
00e |
Profiles |
00Q |
Leads |
00T |
Tasks |
00U |
Event |
015 |
Document |
01t |
Product |
500 |
Case |
701 |
Campaign |
800 |
Contract |
The URL can be manipulated to open a new page, an edit page, or a list view for the record. This is useful for quickly navigating to the desired page or adding a shortcut bar to the browser.
Adding a /o
to the Object URL prefix will open the object tab, as shown in the following screenshot:
Adding /e
will open the New page of the object.
Similarly, when we add the record ID instead of the object identifier to the URL, we can navigate directly to the detail page or the edit page of the record.
18.226.104.202