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
Blanca GarciaBlanca Garcia 

Visualforce email template for Communities

I am trying to create a visualforce email template for the welcome email of my community.

<messaging:emailTemplate subject="Bienvenido al Portal de empleo" recipientType="User" relatedToType="Community">
<messaging:plainTextEmailBody >

To get started, go to {!Community_Url}

Thanks,
{!Organization.Name}
</messaging:plainTextEmailBody>
</messaging:emailTemplate>

I get the following error:

Error: Unknown property 'core.email.template.EmailTemplateComponentController.Community_Url'

Are recipientType="User" and relatedToType="Community" the right things to use? Where can I see the mergefields I can use?
Any help welcome!

Thanks!
 
Best Answer chosen by Blanca Garcia
Blanca GarciaBlanca Garcia
After reading many hours, the solution came trhough this link:

https://salesforce.stackexchange.com/questions/63417/communities-welcome-email-set-password-link-not-working-community-url

The final template would look like this:

<messaging:emailTemplate subject="Bienvenido al Portal de empleo" recipientType="User" relatedToType="Community">
<messaging:plainTextEmailBody >
Congratulations!
This is your new Visualforce Email Template.

{!$Network.NetworkUrlForUserEmails}
</messaging:plainTextEmailBody>
</messaging:emailTemplate>

All Answers

Blanca GarciaBlanca Garcia
After reading many hours, the solution came trhough this link:

https://salesforce.stackexchange.com/questions/63417/communities-welcome-email-set-password-link-not-working-community-url

The final template would look like this:

<messaging:emailTemplate subject="Bienvenido al Portal de empleo" recipientType="User" relatedToType="Community">
<messaging:plainTextEmailBody >
Congratulations!
This is your new Visualforce Email Template.

{!$Network.NetworkUrlForUserEmails}
</messaging:plainTextEmailBody>
</messaging:emailTemplate>
This was selected as the best answer
James LoghryJames Loghry
Awesome.  Thanks for digging this up :)
debikendebiken
Great post!  Hard to believe there's so little info on community welcome/password emails.  I'm having issues with Recipient.Name to display, have tried many things.  If you have something in place that works with the recipientType=User please share!  Thanks in advance!!
Reinier van den Assum | DeloitteReinier van den Assum | Deloitte
Unfortunately it seems there is no option to send a Visualforce email template to Welcome. Or at least, populating it with the Username and such. The only thing I've been able to find is:
"You can’t send a mass email using a Visualforce email template. {!Receiving_User.field_name} and {!Sending_User.field_name} are used for mass email and aren’t available for Visualforce email templates."
Apparently the Welcome email content (User) is send as mass email (e.g. on Community activation) and therefore it is not possible to use Visualforce templates. It feels very undocumented and circling around to find this. But if anyone can share a way to send a Visualforce email including the NetworkUrl AND the Username, I'm more than happy to be convinced :).
debikendebiken
Hello Reinier - We have been using a Visualforce template since we launched our community several months back (partner community), because we have several languages (which is why you see custom labels referenced here).  This is the header, then we have some content.
<messaging:emailTemplate subject="{!$Label.Welcome_to_the_Community}" recipientType="User" relatedToType="Community" language="{!recipient.LanguageLocaleKey}">
<messaging:htmlEmailBody >
{!$Label.WelcomeGreeting} {!Recipient.FirstName},<br/>
And we have the link to the community login page in this anchor tag:
{!$Label.WelcomeGetStarted}&nbsp;<apex:outputLink value="{!$Network.NetworkUrlForUserEmails}">{!$Label.AnchorText}</apex:outputLink>
(translates to "To get started, click here").  It should work for you, just be sure to define the welcome template under your community administration page.