Getting the Root URL in a Formula Field
If you're dynamically constructing a URL in a formula field, you can use the following for the root:
left($Api.Enterprise_Server_URL_500,find(".com",$Api.Enterprise_Server_URL_500)+4)
That will give the base URL regardless of whether you're in a sandbox or production. For example, it will give:
https://myorg--usertest.sandbox.my.salesforce.com in a sandbox, or
https://myorg.my.salesforce.com in production
Easy peasy. Don't hard-code URL's!
Comments
Post a Comment