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
khaitanskkhaitansk 

How to retrieve the login url of the current instance.

Hi,

 

I want to create a custom formula field which should have a different url for Sandbox and Production.

For Ex.

For Sandbox, it should return test.salesforce.com and for production login.salesforce.com

 

The reason I would want to do this is so that i can route the user to other application's production or developer environment accordingly. So, even if the above formula doesnt return me the actual URL, but just an indicator that would also help.

 

I dont want to hardcode the values anywhere because that would mean I might need to correct the values everytime a refresh happens on sandbox from production.

 

Is there a way to achieve this.

 

Thanks.