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

Custom Setting Creation in Apex Test Class

Salesforce Trace Log Query Using Apex

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

AJAX Toolkit Debug Shell

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

Prefix List Of Salesforce Object

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

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

Recurring Scheduling Apex Job for every 10,15 etc minutes

Creating Salesforce Developer Account