fields, general salesforce, Quick Tips

Future-Proof Your Org w/ a Relative Salesforce Server URL

Salesforce Quick Tips
Posted by SFDCr

Salesforce Quick Tips Logo

Use A Dynamic/Relative Salesforce Server URL

Today, I’m going to show you how to future-proof your Salesforce server url.  Instead of specifying a specific Salesforce server, we will use a relative Salesforce server URL.  What does that mean exactly?  Well, have you ever created hyperlinks used in many email templates that point to a page within Salesforce?  Are they “hard links” that point to a specific Salesforce server, “https://na30.salesforce.com/” for example?

If Salesforce moves your org to a different server, you will have to go into each and every email template and make the change!

The Solution/Workaround – Relative URL’s In Email Templates

Create a formula field on the User object using the following formula:

LEFT($Api.Enterprise_Server_URL_270, FIND( "/services", 
$Api.Enterprise_Server_URL_270) -1)

Then, use this field whenever you need to reference the Salesforce Server URL.  If Salesforce moves your org to a different server, no changes necessary!

Do you have any other tips for future-proofing your org?  Post in the comments or message on Twitter!

Also check out the Go With The Salesforce Flow series!

Related Post

Leave A Comment