How to convert from 18 Digit Salesforce ID to 15 Digit ID Using Apex Class

Its possible to convert from 18 Digit Salesforce ID to 15 Digit ID Using String Function Called ‘Substring’ and see the below Example for your reference:


String AccountId = ‘00111000009lpABAAY’;
String Accountid15Digit = AccountId.substring(0, 15);
system.debug(’15 Digit Account ID”+ Accountid15Digit);


For More Details see the below Link:

http://www.salesforce.com/us/developer/docs/dbcom_apex250/Content/apex_methods_system_string.htm

Written by 

Salesforce MVP | 15x Salesforce Certified | Lightning Champion | Application Architect | 6x Trailhead Ranger | Sydney | Australia

Leave a Reply

Your email address will not be published. Required fields are marked *

*