0

I have a formula field called CandidateKey__c which can hold either an opportunity or account id. I have noticed that the CandidateKey__c is not showing the full Id of opportunity or Account objects.

Expected result:

AccountId = 0018E00000uM2xMQAS;
CandidateKey__c = 0018E00000uM2xMQAS;

Actual result:

OpportunityId = 0018E00000uM2xMQAS;
CandidateKey__c = 0018E00000uM2xM;

I need the CandidateKey__c as a filter for my queries; however, I think that doing it in this way might cause filter out or in records that are not expected. Since the Id in CandidateKey__c differs from its original Id.

  • Is there any potential issue with regards to my current approach when running queries?
  • if not having the full id in CandidateKey__c will cause issues. How can I get the full Id in my field CandidateKey__c?

1 Answer 1

4

You need to use the CASESAFEID() function in a formula to obtain the 18 character Id. It takes the 15 character Id as a parameter.

Note though that all Salesforce APIs, including SOQL, treat the two as equivalent. You mainly need the case safe ID to work with external software like Excel, which is not case safe. That is, Excel treats 0018E00000uM2xM and 0018E00000uM2xm as identical, breaking VLOOKUP() and INDEX/MATCH() workflows; the 3-character "checksum" added to make the 18-character Id disambiguates these even in a case-ignoring environment.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .