+ Start a Discussion

How to get a web url from the web service?

I have an external app where I fetch contacts from a salesforce org using the entreprise web service. I want to be able to provide the users with a direct hyperlink to the contact page in salesforce e.g. http://emea.salesforce.com/<Id of the contact> so that they can click the link and go to the page. The trouble is I don't know how to obtain the base url. Does anyone know how to get it?



I should add that for developer accounts it worked fine when I used SForceService.Url to obtain the base url. However it's now on a production org and the web service returns eu0.salesforce.com, whereas the org itself is on emea.salesforce.com, and when they click the link they get a server cannot be found error.

If finding which instance an org is on is not possible, is it reliable enough to ask the user which instance they are on? i.e. user says "I am on emea instance", and their org won't suddenly be moved to na6?




If you use the login() call from the API, it will return the serverURL which designates the instance the users is on. Also, once you find their instance, you can be sure they will always be on it, it never changes.


Hope that helps,



This is the way I was doing it, however with an org on the emea instance it returned an address of eu0.salesforce.com, which doesn't exist.

Looking at http://trust.salesforce.com/trust/status/ it seems eu0 is synonymous with emea, but the url doesn't work.

If it returned emea it would be fine.

call describeSObject("Contact") at look at the various URL properties returned.