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
StevevStevev 

Custom Link using Global Variable

I have a tabbed set of VF pages and to help navigation I added a "hard coded" custom link:

 

<a href="https://mySFinstanceGoesHere/a0O/o">Return to View</a

 

 

I want to generalize it for all instances using a global variable similar to  {!$Organization.xxxxx} say so that it looks something like:

 

 

<a href="https://{!$Organization.xxxx}/a0O/o">Return to View</a

 

That would allow it to work for all instances. 

 

 

I posted it as SF Case but their response was "Unfortunately we don't really support the creation of custom links or buttons"? A strange reply given that custom objects have a dedicated feature for "Custom Buttons and Links" and documentation around linking to Google. 

 

Any help would be appreciated. 

agum34agum34

You might try using the {!Object.Link} which will use your organization domain and the Object ID to get the correct URL for the detail page of that object.  You have to replace Object with a standard or custom object record. 

 

 

<a href="{!case.Link}">View Case #{!case.CaseNumber}</a>

 

 I tried using {$Site.Domain} but that seems to be blank. Maybe only used for Force.com Sites?

 

<a href="https://{!$Site.Domain}/a0O/o">Return to View</a>

 

 

 

 

StevevStevev
Thanks for the suggestion. I'll do some research around it.
agum34agum34

You can use a Custom Setting (hierarchy only) to store the value for each sandbox instance.  You would have to update it each time you refresh your sandbox.

 

Custom Setting called SFInstance__c with a field URL__c. Then set the value to https://cs1.salesforce.com (or your instance).

 

 

<a href="{!$Setup.SFInstance__c.URL__c}/a0O/o">Return to View</a