+ Start a Discussion
GlennWGlennW 

How can the customer determine their OrganizationID?

Is there a way for a customer to determine their OrganizationID from the salesforce.com user interface?

GlennW

sfvoicesfvoice

How timely!  I have an OrganizationId question as well. 

You can query your own OrganizationId using either the getUserInfo() method or quering the Organization Object. 

SFUserInfo = SFbinding.getUserInfo();

Session[SES_SF_ORG_ID] = SFUserInfo.organizationId;

Or something like:

qrOrganization = SFbinding.query("SELECT Id, Name, Phone, PrimaryContact FROM Organization");

My problem is that using the getUserInfo() the organizationId is "00D300000000GOl".  Using the query object it is "00D300000000GOlEAM"  (Note the "EAM" on the end of the second one).  I've tried several Organizations and they are all similar. 

Which one is correct?  The problem is that not all users have permission to query the Organization object (I've found that if I assign the user to profile that has "View all Data" Administratrive Privlege it works, but this isn't acceptable for production users.

 

ScotScot

sfvoice ...

Sometimes you are getting the 15 character internal ids, and sometimes the 18 character case-insenstive ids. There are some options you can set in the API to determine which type of ids will be returned. Either works when sending ids, and the UI always uses the 15 character version.

For more info, refer to:

http://forums.sforce.com/sforce/board/message?board.id=NET_development&message.id=532

That thread also includes some sample code for going 15->18 characters. the other direction is simpler, of course .. you just dump the last three characters

GlennWGlennW

My challenge is not getting the OrganizationID via code but allowing the user to get it.  I use the OrganizationID for authorization to my application so in order for a user to sign up for a free trial they will have to provide me with a valid OrganizationID.

I'm thinking that the only way to do this will be to build a small application that will login and then use the getUserInfo method to display their OrganizationID.

Cheers;
GlennW

DevAngelDevAngel

Hello All,

As a rule, you should always recieve an 18 char id from the api v 3.0, no matter which call.  If there is a call returning a 15 char id, it is a bug (thank you very much for bringing this to our attention). 

Both ids that where mentioned in the earlier post are the same ids but in the two different formats. So both are correct as far as identifying the user's org.

The application uses 15 char ids for urls and such, so if you need to construct a url with an id in it, remove the rightmost 3 characters from an 18 char id and voila.

Cheers