Convert 18-character Salesforce Id to a 15-character case-sensitive string

In Spring 21 release, Salesforce introduced new method in System.Id namespace to convert 18 charater id to 15 character.

String Id_15_char = '0D5B000001DVM9t';
String Id_18_char = '0D5B000001DVM9tkAh';
ID testId = Id_18_char;
System.assertEquals(testId.to15(), Id_15_char);

How to convert a 15-character Id to an 18-character Id using formula –

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.