15 to 18 char ID Conversion in Apex


As 15 or 18 char ID is concerned, You can use both the formats.

But, to Convert From 15 char Id to 18 Char ID, You just need to store it in to ID field.
See the Example below.

String recordIdAsStr = '0019000000G0IS8';
Id recordIdAsID = recordIdAsStr;
system.debug('15 Char Record ID : ' + recordIdAsStr);
system.debug('18 Char Record ID : '+recordIdAsID);

I hope this will help you.

Comments

Popular posts from this blog

System.AsyncException: The Apex job named is already scheduled for execution.

Custom Setting Creation in Apex Test Class

Error : "Trigger must be associated with a job detail"

AJAX Toolkit Debug Shell

Salesforce Trace Log Query Using Apex

how to get object name from id / prefix value in salesforce

How to Query All the batch classes in your Salesforce Instance using APEX

Creating Salesforce Developer Account

Creating MAP from SOQL Query

Custom Pagination Without Controller (Apex)