CASESAFEID(Id) function

CASESAFEID(Id) Formula Function

I came across a new formula function today and just wanted to share it. 


When is an ID not an ID?

If you have been using Salesforce for a while you have noticed that an ID field in Salesforce can either be written with 15 digits or 18 digits

Essentially both IDs are valid, but the 15 digit version is case insensitive whereas the 18 digit version is case sensitive.

If you haven't noticed this before, check out this overview of the differences here.

Why is this important?

When you are trying to update a record by specifying an ID, you need to use the full 18 digit version. Luckily, there is a handy formula in Salesforce for bringing back the ID of the record you want to update:
CASESAFEID(Id) 
For more information on using this formula field I recommend this post: https://help.salesforce.com/HTViewSolution?id=000005288

Why do we need this function?

Interesting question. As we already have the Record.ID field it seems strange that Salesforce went to the trouble of creating this Formula to convert the 15 digit field to the 18 digit. Why not just have the 18 digit version available?

After a quick google it turns out others have also asked the same question and this suggestion is currently on the Success Community. If you think it's a good day, visit this page and pop a vote in for it.

Make CaseSafeID a standard field - Success Community

Icon from By Iconfinder, artist Hand-Drawn Goods



Comments