Ever wondered the difference between 15&18 character Salesforce IDs?

 

Salesforce gives all records an 18 character Id, but sometimes they show up only as 15 characters. This is because if you are working in a case-sensitive system, the first 15 characters is enough for it to be a unique ID, but if you have the last three characters also, then even if you ignore the case the Id is still unique. Ok, so obviously to go from 18 characters to 15 you just drop the last 3 characters. But also, if you have the 15 character Id you can generate the last three characters to compose the 18 character Id. Here is an apex snippet http://www.snipplr.com/view/39952/salesforce-convert-15char-to-18char-ids-in-apex/ that does the conversion.

 

Note also, from Blogger extraordinaire ‘SteveMo’…

Create a Formula(TEXT) field on all of the objects that you use on your SFDC org and use the formula:
CASESAFEID(Id)
that will give you the complete Case-Insensative 18 char ID