0

My problem is the following. We have a server migration soon and we have hardcoded the instance number in our email templates that point out to our Production environment (in this case NA44).

So in my case, I created a formula field that must be filled with the instance number. Say that the URL in question looks like this: https://neb--qa.cs69.my.salesforce.com

How can I get the "cs69" part that is the only thing that matters for me? I tried different formula combinations using the $Api.Partner_Server_URL_140 merge field but I couldn't do it yet.

1
  • does this really matter? why not just change the URLs to be https://neb--qa.my.salesforce.com - sfdc will take care of the redirect to the org
    – cropredy
    Sep 5, 2019 at 19:20

1 Answer 1

0

We created a Hierarchy Custom Setting called Environment Settings. This has tier specific information such as Base URL.

Hierarchy Custom Settings are accessible from formula fields.

One important thing to remember is to update this Custom Setting when you do a Sandbox refresh or deploy this between tiers to make sure it has the correct value.

2
  • Thank you for your response, Mike. But in this case, we want to maintain this setting as dynamically as possible. I saw this solution once, but besides the server migration happens once in a while, if we can keep this feature as a dynamic one, the better. Sep 5, 2019 at 17:14
  • Unfortunately, I don't know of a way to make it completely dynamic for formula fields and email templates. At least with the Custom Setting, it is in one place, so you only have to maintain it one place. I guess you might be able to create a scheduled apex job that runs daily and sets the Custom Setting values, although I haven't tried this approach. Sep 5, 2019 at 17:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .