Loading

Convert a 15-character Id to an 18-character Id

Veröffentlichungsdatum: Apr 3, 2026
Beschreibung
Convert 15 character IDs to 18 character IDs to update records, or to make it easier to work in systems that aren't case-sensitive.
Lösung

To create a formula that will give you the 18-character Id of records

Option 1


Classic

1. Go to Setup | Customize | object name | click Fields

a. For Custom objects: Setup | Create Objects | object name

2. In the related list "Custom Fields & Relationships" click New.
3. Click the Formula radio button.
4. Click the Text radio button for 'Formula Return Type.'
5. Input the following Formula into the Formula Editor:

CASESAFEID(Id)


6. Set Field Visibility, add, or remove from the page layout.
7. Click Save.


Lightning
 

1. Go to Setup | Object Manager | Object name | Fields & Relationships
2. Click New.
3. Click the Formula radio button and click Next.
4. Click the Text radio button for 'Formula Return Type.'
5. Input the following formula into the Formula Editor:

CASESAFEID(Id)


6. Set Field Visibility, add, or remove from the page layout.
7. Click Save.


Note: When dealing with record types only custom record types have Ids. Please review Set Record Type Preferences for more information.

Option 2

The other way is to use the following Javascript as a bookmarklet in your browser to manually convert IDs any time.

  1. Create a new bookmark
  2. Name it something memorable (like "Salesforce ID Converter")
  3. Add the code below to the URL
  4. Save the bookmark

User-added image Note: This may not work in the Edge browser.

javascript:(function(){
var input=prompt('Enter 15-character ID');
var output;
	if(input.length == 15){
		var addon="";
		for(var block=0;block<3; block++)
		{
			var loop=0;
			for(var position=0;position<5;position++){
				var current=input.charAt(block*5+position);
				if(current>="A" && current<="Z")
					loop+=1<<position;
			}
			addon+="ABCDEFGHIJKLMNOPQRSTUVWXYZ012345".charAt(loop);
		}
		output=(input+addon);
	}
	else{
		alert("Error : "+input+" isn't 15 characters ("+input.length+")");
		return;
	}
prompt('18-character ID:',output);
})();

 

To use the converter:

  1. Click the bookmark
  2. Enter the 15-character ID and click "OK"
  3. Copy out the resulting 18-character ID

How-to Video: How to Convert a 15-Character Id to an 18-Character Id 

 

Zusätzliche Ressourcen

API versions after 2.5 use the 18-character format exclusively. Reports query the database directly and return a 15-character ID. Tools like Data Loader or Weekly Data Export service will export records with the 18-character ID.

Locate the Unique ID of a Record in Salesforce

Create 18-character record ID with custom formula field

Nummer des Knowledge-Artikels

000385066

 
Laden
Salesforce Help | Article