I have a customer portal and an associated site for it. I have modified the Email Template that salesforce uses when a new user is created through the customer portal. The email template needs to have the login url of the site. In the email template I have added a Site merge field {!Site.TopLevelDomain} to get the url of the site.However nothing is displayed for the merge field.Any help would be much appreciated.
2 Answers
When a merge field isn't populated in an Email Template it's usually because there is no value for Salesforce to use. In your case it may be because Salesforce has no way to know that this email is being sent in relation to a particular Site. ie. If the email is triggered from a new User, what's linking that User to the Site?
Remember, the Email Template tool is very primitive and provides you with merge fields for all Objects, even if the template will be used in a capacity whereby it has absolutely no chance of knowing how to use that merge field.
I haven't used the Customer Portal much myself, but if you can capture who is creating the record (ie. the site user) you possibly could create a formula in your Email Template to define the site. It's a bit of a hack though. Another approach is to create a formula field on the User object to define the URL based on the Site User that created the record.
Nick Cook you've mentioned above that create a formula in email template. could you kindly explain me how to form that formula in email template to define the site??