Converts a 15-character Salesforce Id into its 18-character, case-safe equivalent. Useful whenever you have an Id in the shorter, case-sensitive format and need the longer one instead — for a comparison, a storage key, or anywhere case-sensitivity would cause problems.
How to call this method
global static String id15to18(String inID)
Parameters
|
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
|
|
Yes |
The Id to convert. |
Return value
Returns a String — the 18-character Id.
-
If
inIDis already 18 characters, it's returned unchanged — safe to call on an Id regardless of which format you already have. -
If
inIDis any length other than 15 or 18, this returns an empty string rather than throwing an error — worth checking for if you're not certain the input is a valid Id.
Example
String fullId = cg.SDriveTools.id15to18('500XX000001abcA');