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
sgkmillssgkmills 

Salesforce Global Server variable

Is there a global variable for the salesforce server you are connecting to.

Currently, I have the following code:
Code:
 var saveURL ="https://tapp0.salesforce.com/"+ newOppId; 


But, I don't want to hardcode the URL, so how can I get the salesforce server name that I am currently connected to.

I was trying to use the URLFOR function, but I still need a target value and didn't know what I could put.

Thanks in advance

TCAdminTCAdmin
Hello sgkmills,

I'm not possitive what you are looking for but if your are running the s-control within the system it will automatically direct to your current server. If you do a call window.location = '/' + oppId it will automatically direct to the current server. If you are on NA1 it will automatically populate the https://na1.salesforce.com without putting it in your code.

Hope this helps.
sgkmillssgkmills
I found this out last week by deleting the 'https://na1.salesforce.com '
 
Thanks