A Salesforce ID is the primary key field for any object. It is a primitive type in Salesforce. Salesforce Ids come in 15-character and 18-character "case safe" varieties, which are treated as equivalent by all APIs.

A Salesforce Id is the primary key field for any object. It is a primitive type in Salesforce.

Salesforce Ids come in 15-character and 18-character "case safe" varieties, which are treated as equivalent by all APIs. 18-character Ids postfix a three-character code serving to disambiguate 15-character Ids which differ from one another only in case, making these values safe to use in tools like Microsoft Excel.

18-character Ids are provided in API exports and via the CASESAFEID() formula function, while the Salesforce Classic UI and reporting typically surface 15-character Ids.

In Apex, Id and String are different types, but can be casted to one another.

Note that most Web services tools, including .NET and WSC, map the ID simple type defined in the API WSDL (Enterprise or Partner) to a string. However, other tools generate a specific ID class to represent the ID simple type. Please consult your Web services toolkit documentation for more information.

history | excerpt history