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
DeptonDepton 

Return URL in formula

Hi,

 

In my custom link I use &ReturnURL={!Opportunity.Link} for the return URL

 

How can I do it in a formula field?

 

{!Opportunity.Link} is not available, and do not want to include the instance name like:

 

https://cs8.salesforce.com/

 

I am looking for something dynamic that can be used in any instance?

 

Any ideas?

 

Thank you!

 

 

Best Answer chosen by Admin (Salesforce Developers) 
DeptonDepton

I have created a formula field called: Opportunity_Link__c

 

"https://"+ MID( $Api.Enterprise_Server_URL_25, 9, 18) + "/"

 

 

then the URL in the other formula is:

 

&ReturnURL="&Opportunity_Link__c&""&Id&"

 

and works fine....don´t know if there is any simple way, but at least I got it!! :)

 

All Answers

DeptonDepton

I have created a formula field called: Opportunity_Link__c

 

"https://"+ MID( $Api.Enterprise_Server_URL_25, 9, 18) + "/"

 

 

then the URL in the other formula is:

 

&ReturnURL="&Opportunity_Link__c&""&Id&"

 

and works fine....don´t know if there is any simple way, but at least I got it!! :)

 

This was selected as the best answer
communitycommunity

you can simply use

 

{!Opportunity.Id}

DeptonDepton

Thank you for getting back to me,

 

I wasn´t clear enough,  I needed to specify the instance in a custom link, so I needed something else

 

&ReturnURL="&Opportunity_Link__c&""&Id&"

 

 

As you mentioned {!Opportunity.Id} works perfectly for a formula field, but we are migrating from one instance to another and as you can see, I needed to specify in the &ReturnURL, the salesforce instance; so when migrating or when creating a full sandbox the custom link works.

 

So I finally created this formula field that gave me the expected results.