Play Games

Search This Blog

Showing posts with label How to convert 15 digit salesforce record Id to 18 digit Salesforce record Id in Apex. Show all posts
Showing posts with label How to convert 15 digit salesforce record Id to 18 digit Salesforce record Id in Apex. Show all posts

Wednesday, December 5, 2018

How to convert 15 digit salesforce record Id to 18 digit Salesforce record Id in Apex

Solution: We just need to declare a variable of type Id and then assign the 15 digit number to that variable.

Example:

String s15DigitLeadId = '00Q0o00001OoyzD'; //Assume this is record Id of Lead of 15 digits
Id i18DigitId = s15DigitLeadId;
system.debug('Eight Digit Id:'+i18DigitId);

Output: Eight Digit Id:00Q0o00001OoyzDEAR