+ Start a Discussion
someonesomeone 

Object Id's for same object differ

I'm inserting a task (call log) object via openCTI and saveLog(). The response comes back with the id of that object. Then at a later time I want to query for details of the object (via an apex class), which works fine, but the id of the object is slighly different in the query response. For example, the first id returned is 00To00000080Ik3, then when I query for the object through an apex class, the id comes back as 00To00000080Ik3EAE (the same id except its postfixed with EAE). What is the postfix and is there a way to get the object with its original id (e.g. 00To00000080Ik3).

Thanks.
Balaji BondarBalaji Bondar
As we know that each record Id represents a unique record within an organisation. There are two versions of every record Id in salesforce :

15 digit case-sensitive version which is referenced in the UI
18 digit case-insensitive version which is referenced through the API

The last 3 digits of the 18 digit ID are a checksum of the capitalizations of the first 15 characters, this ID length was created as a workaround to legacy systems which were not compatible with case-sensitive IDs.
The API will accept the 15 digit ID as input but will always return the 18 digit ID.

 

You can create a custom formula field that returns type text, place the code below  in the formula field , you will got an 18 digit ID that you can easily add to any report.

 

Id
& MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",(
   IF(FIND(MID(Id,1,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0)
   +IF(FIND(MID(Id,2,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0)
   +IF(FIND(MID(Id,3,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0)
   +IF(FIND(MID(Id,4,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0)
   +IF(FIND(MID(Id,5,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0)
   )+1,1)
& MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",(
   IF(FIND(MID(Id,6,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0)
   +IF(FIND(MID(Id,7,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0)
   +IF(FIND(MID(Id,8,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0)
   +IF(FIND(MID(Id,9,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0)
   +IF(FIND(MID(Id,10,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0)
   )+1,1)
& MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",(
   IF(FIND(MID(Id,11,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0)
   +IF(FIND(MID(Id,12,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0)
   +IF(FIND(MID(Id,13,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0)
   +IF(FIND(MID(Id,14,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0)
   +IF(FIND(MID(Id,15,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0)
   )+1,1)

 Important :
If this is what you were looking for then please mark it as a "SOLUTION" or You can Click on the "Like" Button if this was beneficial for you.
 
someonesomeone
Can I also safely assume that it will always be 3 characters at the end, and just remove them for my purposes? Essentially I am querying for a list of ids, then I need to match up the responses with the original ids.
someonesomeone
Can you provide some instruction on how/where to add that formila?
Thanks