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
AceldamaAceldama 

How do I make my Customer Button URL references "domain independent"?

Hi!  I am trying to get me org ready for a server change and am trying to make my buttons domain independent.  For instance, I have a button that references a URL:

 

Button URL:  https://mkto-si.na0.visual.force.com/apex/mkto_si__Send_Marketo_Email?contactType=Lead&contactIds={!Lead.Id}

 

I will no longer be on server na0.  How do I make this button work regardless of the domail?  I tried the following to no avail:

.../apex/mkto_si__Send_Marketo_Email?contactType=Lead&contactIds={!Lead.Id}

apex/mkto_si__Send_Marketo_Email?contactType=Lead&contactIds={!Lead.Id}

 

Nothing seems to work.

Best Answer chosen by Admin (Salesforce Developers) 
AceldamaAceldama

Thanks for the input.  Actually got it working by just enclosing the URl with the domain:

"apex/...."

All Answers

sandeep1989sandeep1989
use this instead of your url
URL.getSalesforceBaseUrl().toExternalForm()
AceldamaAceldama

Thanks for the input.  Actually got it working by just enclosing the URl with the domain:

"apex/...."

This was selected as the best answer