Wednesday 27 May 2015

How to Convert Salesforce 18 digit ID to 15 digit ID in Apex


              You can convert your 18 digit Salesforce ID to 15 digit using the String method. The below example will show how to use,

  1. String str = '0019000001O73UCAAZ';
  2. String convertedStr = str.subString(015);
  3. System.debug('15 digit ID:'+convertedStr);


However, Salesforce recommends that you use the 18-character ID.

Reference: Field Types

No comments:

Post a Comment

Activities: Assign Tasks to a Queue Salesforce Lightning

Salesforce announced to assign Tasks to a Queue beginning from Spring'20 release. How does it work? In Setup, enter Queues in th...