SFDC ID値の15桁表現と18桁

Posted by ExiaHuang on July 21, 2017



String accountId15digit = contact.accountId.substring(0, 15);


Id accountId18digit = contact.accountId.substring(0, 15);

Id型はすべてのId値を18桁で扱います。15桁の値を代入した場合は18桁に変換されます。 Id値はString型で扱わず、Id型でハンドリングするのが安全な方法です。  ※数式の場合はCASESAFEID関数を使います。


Idの15桁表現はcase-sensitiveです。 つまり、大文字・小文字を区別して扱わないとユニークになりません。 大文字・小文字の差異のみがある複数のレコードが存在する場合があります。 対して、18桁表現では大文字・小文字を区別しません。


Converting 15 digit Salesforce opportunity ID to 18 Digits : In our previous Salesforce Training Tutorial we have learned about Social CRM. In this Salesforce Training Tutorial we are going to learn about what is the process of Converting 15 digit Salesforce opportunity ID to 18 Digits ID number.

Custom objects and Standard Objects in Salesforce.com will have internal record ID. Internal record Id for all custom objects and Standard Objects like Opportunity, Account, Contact and so on will have only 15 digit ID number by default.

15 digit Id number will have numeric digits range from (0-9), a Lowercase letter(a-z) or a Uppercase letters(A-Z). 15 digit ID in salesforce.com is case sensitive. Example 100000000000ABC is different from 100000000000abc. When using external productive tools like Microsoft Excel, MS Access and SQL Server external ID’s are not case sensitive and they don’t recognize the difference between 100000000000ABC and 100000000000abc.

Salesforce.com has recognized this problem and Salesforce.com has established 18 digit character insensitive ID. This 18 Digit ID is case insensitive which is formed by adding a suffix to the 15 Character Id number.