Subscribe to my full feed.

Salesforce.com record IDs come in two flavors. The flavor you see in the browser is a 15-character, case-sensitive version. The flavor you see when using the data loader or other API-based tools is an 18-character non-case-sensitive version.

So when troubleshooting integrations, and our IT department says "Can you provide some sample IDs?", we needed a way to quickly take the 15-character ID we were staring at in the browser, and convert it to an 18-character version that our (non-case-sensitive) IT department could reference in their data warehouse.

Initially, we used the Data Loader to get this info. As in:

SELECT
Id
FROM
Contact
WHERE
Id = 'Insert 15-char ID here'

That would return the 18-character version, and all was well. But to open the data loader, grab my security token, select an object and an export file, type the code, etc was just too much work.

Luckily, Salesforce publishes the algorithm used to convert from the 15-character version to the 18-character version (which is really just the 15 character version with 3 additional characters appended).

This week, I'll be exploring the published algorithm, creating an Apex Class to do the conversion for me, with a Visualforce front end. Stay tuned!

(Disclaimer: As always, I'm sure there is an easier way to do this - at least I'd imagine so. Even if there was, I'd still do it this way, just for fun!)

0 comments:

Post a Comment