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

Email Template with Site Fields



I have created a email template and added site's custom web address as {!Site.TopLevelDomain}.


This email template is used to send email alert through a workflow.


This workflow will get fired as a result of some custom action(field update) through website.


I am receiving the email but without the custom web address of the website.


I have tried with some other fields like {!Site.UrlPathPrefix}, {!Site.Subdomain}

but it doesn't display any thing within email template as a result of these fields.


For the time being i have hard coded this url within the email template. But I want to remove this hard coded url.


Is there any thing else which need to be provided?

If any one have any idea please tell me.





           If you want to get siteURL for the current request through merge fields you can access that through site global variables viz:-

  • {!$Site.CurrentSiteUrl}, this will give you siteURL.
  • {!$Site.Domain} it will return the domain name for your organization.

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 



Hi Ispita,

Thanks for you suggestion.

I think you have listed the merge fields for the visual force page.

The field which you have listed are not present in the dropdown list while creating email template.


I want to show the website url for my sandbox and production edition through merge fields within email template. Without changing email template it should work fine for both environments.


If you have any other solutions then please do let me know.



Amit Ashtekar




David WilgusDavid Wilgus

did you ever get an answer to this, I am trying to do something simular, I have a email template that will go out to a contact with a link back to the site, I am trying to get the site domain name. I can mainly type it but its different in sandbox then production, there has to be a global variable that can be pulled for this.


I have not received any answer to this question.

If you find the solution for it then, please tell me.

Avinash KaltariAvinash Kaltari



Hi Avinash,


I was not able to find any solution on it.


I have made it hard coded as for the time being.


If you find any solution please let me know.



Here is a workaround for when you are sending an email from one record, but need a link for a related record.  It basically takes the link for the current record, and replaces the ID with the ID of the related record.  Note the bolded "ID" - it has to be there.

<a href="{!LEFT(CurrentRecord__c.Link, LEN(CurrentRecord__c.Link) - 15)}{!CurrentRecord__c.RelatedRecordID__c}">{!CurrentRecord__c.RelatedRecord__c}</a>
Or, if you just need the org url:  {!LEFT(CurrentRecord__c.Link, LEN(CurrentRecord__c.Link) - 15)}
Vidya Deo 9Vidya Deo 9
This is helpful. I was able to use it.
Ivan VrtacnikIvan Vrtacnik
What I did was put the site domain into a custom setting and referenced that setting field in the email template, like so:
{!$Setup.Config__c.Site_Domain__c}<Page Name>?id={!Contact.Id}
All that needs to be done is populate the field value on the custom setting in each environment, a task which an admin can do without the aid of a developer.
Jade Fischer 24Jade Fischer 24
Ispita_Navatar I have been looking everywhere for that the domain thank you.