function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
HarryBHarryB 

How to generate a direct Salesforce link to an object?

Hello,
 
this is an example of what I'm doing:
 
1) Create e.g. a new Lead using the API
2) Show the new lead directly in the Salesforce GUI by having a direct link on my app
 
Now, "our" Salesforce instance has the domain https://emea.salesforce.com, however another user might access Salesforce by another URL. So if I create a static link https://emea.salesforce.com/00Q33242342, it might not work for people outside the EMEA zone/server.
 
Is there a way to find out, which Salesforce server the current user is logged in - maybe by parsing the "ServerURL" part of the SessionHeader?
 
TIA
Harry
Ian_HIan_H
Harry,
 
You don't need to specify the prefix on the link..
- Just specify the bit after the first /
 
 
Just use the link /00Q33242342
 
The prefix will automatically be added using the current prefix that the user is using.
 
Ian.
HarryBHarryB

Ian,

this would work if I'm on salesforce.com and linking to my newly created object - e.g. a custom weblink on a salesforce page.

Problem is, I have to link from my own script, which is running on my own server - meaning a different domain that salesforce.com. So I guess this won't work :-(

Regards,

Harry

Ian_HIan_H
SuperfellSuperfell
Do a describeSObject("Lead") call and look at the url* properties, they have fully qualified URLS to the UI, which hav the correct instance info in them.
HarryBHarryB

Thank you guys, thats exactly what I needed!

Cheers,

Harry