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 

3x Salesforce MVP | Platform Champion | 18x Salesforce Certified | MuleSoft Certified | 8x Trailhead Ranger | TechForce Services | Sydney | Australia

Leave a Reply

Your email address will not be published.

*