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

(4514)

Written by 

I am Sakthivel Madesh, a certified Salesforce Developer & Administrator working on Salesforce Technology since 2011. I am currently working in Techforce Services as Sr. Salesforce Developer. I have worked on multiple technologies Like PHP, Java, Salesforce, I am very passionate about Salesforce and to earn 13x Salesforce Certification. I love Trailhead for learning Salesforce Skill and Become a Trailhead Ranger too. I Love to Learn & Share my Salesforce knowledge to Salesforce Learners/Beginner using My Blog and Salesforce Community.

Leave a Reply