• d19engel
  • 5 Points
  • Member since 2010

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 5

I'm using the partner.wsdl to make a soap request from Java to the API to get information about a user based on their session id.  One of the things I'm retrieving is an Org ID to make sure its within a known and trusted set.  Just recently it seems that something may have changed with what is returned from the getOrganizationId() call.  The value returned no longer seems to match the Org ID listed in Salesforce.com under Setup > Company Information.  I am now seeing 3 characters appended to the valid org id string; EA0 in one case and EA2 in another.  Has anyone else seen this? 

Message Edited by efazendin on 06-24-2009 04:36 PM

Hey guys,


needed a way to convert from a 15 digit ID to an 18 digit one.

Found the javascript version for just such an action here: http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=13148


tried to make my own apex version but the last digit keeps coming out wrong.  Any Ideas?






String id = '001Q0000002NXad'; //a sample id


String suffix = '';

for(integer i=0;i<3;i++){

Integer flags = 0;

for(integer j=0;j<5;j++){
String c = id.substring(i*5+j,i*5+j+1);

if(c >= 'A' && c <='Z'){

flags += 1 << j;

if (flags <= 25) {

suffix += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.substring(flags,flags+1);

}else suffix += '012345'.substring(flags-26,flags-26+1);

System.debug('18-DIGIT:'+Id + suffix);




Message Edited by astro on 05-01-2009 10:04 PM
Message Edited by astro on 05-01-2009 10:10 PM
  • May 01, 2009
  • Like
  • 0

I thought that the ID in the URL for any object is unique. For instance, if the URL is some account is ‘https://www.salesforce.com/0016000000In2ky’, where 0016000000In2ky is the internal SF ID. But the problem is that the actual ID pulled from the SF database is ‘0016000000In2kyAAB’.

So, if I want to create a SOQL query in AJAX based on ID like

result = sforce.connection.query("Select fice__c from Account where Id like ’" + name + "’");

 where 'name' is the ID from the URL, the query wont work. Also, even though documents suggets that you can use '%' in SOQL, a query like:

result = sforce.connection.query("Select fice__c from Account where Id like ’" + name + "%’");


still does not work.

I would truly appreciate any help in this regard.


  • February 25, 2008
  • Like
  • 0