Loading

Create an 18-Character Salesforce Record ID Using a Custom Formula Field

Fecha de publicación: Jun 28, 2026
Descripción

In Salesforce, record IDs come in two formats: 15-character (case-sensitive, used in the Salesforce UI) and 18-character (case-insensitive, safer for use in external systems, reports, and data integrations). The 18-character ID is preferred when exporting data to Excel or external databases where case sensitivity may cause mismatches.
This article explains how to create a custom formula field that converts the standard 15-character Salesforce record ID to its 18-character equivalent. This approach is necessary in the following scenarios:

  • The User object does not support Workflow Field Updates, so an automated field update cannot be used.
  • The formula to generate the 18-character ID is too large to fit within a single custom formula field's character limit (maximum 5,000 characters). The formula is split into three parts using the MID function to stay within this limit.

Note: To convert an 18-character Salesforce record ID back to 15 characters, simply remove the last 3 characters from the right of the 18-character string.

Solución
Create a formula field with return data type Text and use the formula below as its value. You can name the field "Record ID 18-char" or any name you prefer.
How the formula works: The formula appends a 3-character checksum to the standard 15-character ID. It evaluates each group of 5 characters in the original ID, checking whether each character is an uppercase letter (A–Z), and uses that result to calculate a checksum character from the encoding string "ABCDEFGHIJKLMNOPQRSTUVWXYZ012345". The three groups of 5 characters each produce one checksum character, which together form the 3-character suffix appended to the original 15-character ID.
The formula uses three MID function blocks — one for characters 1–5, one for characters 6–10, and one for characters 11–15 of the original ID — each contributing one checksum character. This structure keeps the compiled formula size within Salesforce's 5,000 character formula limit.
Paste the following formula into the formula field editor:

Id &

MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",(
IF(FIND(MID(Id,1,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0)
+IF(FIND(MID(Id,2,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0)
+IF(FIND(MID(Id,3,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0)
+IF(FIND(MID(Id,4,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0)
+IF(FIND(MID(Id,5,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0)
)+1,1)

&

MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",(
IF(FIND(MID(Id,6,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0)
+IF(FIND(MID(Id,7,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0)
+IF(FIND(MID(Id,8,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0)
+IF(FIND(MID(Id,9,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0)
+IF(FIND(MID(Id,10,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0)
)+1,1)

&

MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",(
IF(FIND(MID(Id,11,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0)
+IF(FIND(MID(Id,12,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0)
+IF(FIND(MID(Id,13,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0)
+IF(FIND(MID(Id,14,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0)
+IF(FIND(MID(Id,15,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0)
)+1,1)
Número del artículo de conocimiento

000385585

 
Cargando
Salesforce Help | Article