How to create a field with the Salesforce 18 digit ID

In the main Salesforce interface, you typically only see the Salesforce 15 digit ID. This ID is case sensitive which means that 003i000000NYZrg isn't the same record as 003i000000nYZRg. However, if you export a report to Excel and try and do comparisons between different lists using this ID as the comparison (using VLOOKUP), you'll have a lot of problems since Excel doesn't see these as separate records.

To get around this problem, Salesforce has an internal 18 digit ID that Excel will see as completely different fields. Here's how you create a formula that has that 18 digit ID that you can add to your reports and avoid headaches in Excel.

The 15 Digit ID

  1. This is the 15 digit Salesforce ID which is available in reporting
  2. To create an 18 digit ID go to setup

Setup

  1. Navigate to the object you want to create the 18 digit ID for
  2. In this case we will be using Contacts
  3. Go to Fields

Custom Fields

  1. Scroll down to Custom Fields & Relationships
  2. Click New

Formula Field

  1. This will be a formula field
  2. Click Next

Formula Field Type

  1. Give the field a meaningful label, in this case I chose 18 Digit Contact ID since we are creating it on the Contact Object
  2. This will autopopulate the Field Name stripping special characters, spaces, and not starting with a digit
  3. This will be a Text field
  4. Click Next

The Formula

  1. Simply type casesafeid(id) into the formula editor no matter what object you are working from this is all you have to do
  2. Click Next

Field Level Security

  1. Since it's a formula field it can only be read-only for all profiles
  2. Click Next

Page Layouts

  1. Decide what page layouts to add it to, if any
  2. Click Save

Reporting Availability

  1. Now the field is available for reports, exports, and imports for that object
  2. It is not case sensitive like the standard 15 digit ID is