You need to sign in to do that
Don't have an account?
Popping a contact(found using API) in user's browser session
Hi,
We can use the SF.com partner web service to login as a user (who is enabled for API access), search Contacts based on phone# and get the Contact ID all right. Now, we need to "popup" the contact in the browser using which the same user is logged in to SF.com on the same PC. The URL to pop contact works obviously only if it is built using the exact same force.com endpoint in the user’s browser session. Is it possible that, for the same user, session started using the partner web service and browser could be on different SF.com instance? Or, for the same user, no matter how the session is started (from browser or web service or otherwise,) will it always use the same SF.com instance?
Assuming it is indeed true, we are planning to use the SF.com endpoint URL returned in “serverUrl” when using the web service to derive the endpoint URL for the user’s browser session using the following scheme:
The “serverURL” returned in the login response from the partner web service is something like this: https://na1-api.salesforce.com/services/Soap/c/22.0/xxxxx
And, the SF.com URL for the same user’s browser session is something like this: https://na1.salesforce.com/home/home.jsp.
So, after retrieving the contact’s ID (say yyyyy) from the partner web service, we can make the contact URL to pop by transforming the “serverURL” accordingly (by removing the “-api” from it and then trimming all text after salesforce.com, that is, “services/Soap/c/22.0/xxxxx”) and adding contact’s id to it. The resultant URL becomes https://na1.salesforce.com/yyyyy and we can trigger browser to navigate to it which then shows the contact correctly in the user’s browser session. This approach seems to work but it will be great if it can be confirmed that it is indeed the correct approach of deriving the contact’s URL for showing the contact in the user's browser session or it might have some nuances to consider.
Thanks in advance and regards
A browser session & UI session for the same point in time/user will be on the same instance. So yes, you can just substitute in the actual contact Id and go.
All Answers
The correct URL templates for browser views are exposed in the describeSObject result, so you should call describeSObject("Contact") and look at the url* values returned from that, rather than trying to handle the transormation yourself. (particularly as the strip -api step doesn't work for some instances)
Thanks for quick response! The urlDetail for Contact object is something like: https://na14.salesforce.com/{ID}. So, I understand ID can be replace by Contact's ID found using the web service. So, will the user's browser session will always the same SF.com instance, i.e. na14.salesforce.com(so that URL for contact built using this manner in a web service session for a user can be used in the user's browser session)?
Thanks again and regards
A browser session & UI session for the same point in time/user will be on the same instance. So yes, you can just substitute in the actual contact Id and go.
Great...thanks!
One more question. If no contact is found, we might want to pop contact’s search page similarly. It looks like contact search page has a URL like https://na1.salesforce.com/003/o. Will it be this way for any enterprise? If so, we can derive it similarly as well.
Thanks and regards
Links found in one organization will be the same in all others (at least, in a similar fashion that follows logic). /003/o might not be the best page to use for a search though... it's a list view, and can't have parameters given to it. Instead, try this:
https://na2.salesforce.com/_ui/common/search/client/ui/UnifiedSearchResults?sen=003&str=Contact+Name&searchAll=false
Where Contact+Name is the search string to search against.