Send from Salesforce - Building Visualforce Email Templates

Back to Help Center

GetFeedback's Send from Salesforce email builder makes it easy to create, export, and send surveys by email. Use Send from Salesforce to set up a survey email, export and paste it right into a Visualforce email template in your Salesforce organization.

A Video Guide on sending out a recurring NPS survey with Visualforce Email Templates from Salesforce

Getting Started

First thing, connect your survey to Salesforce, then you can get started on building your Visualforce template. Then, navigate to Distribute > Email > Send from Salesforce to start building your email. 

NavDistributeSendFromSF

We recommend embedding a survey question into your email. We have a few question types available to choose from: multiple choice, CSAT, NPS, CES, like / dislike, and rating. The question types which can be embedded in your email will be visible in the Call to Action drop down in the Visualforce email builder. 

In this example here, we’ve created a CSAT survey using our rating question type and we’d like to embed it in our email template

VF01

We need to remove the title page from the survey. Hover over the title page in the survey outline, and click on the X in the top right hand corner of the thumbnail to remove it.

removetitlepage

Create Your Email Template

Choose your Email Call to Action. Choose to either embed a button to start your survey, or embed a survey question. 

VFCTA

Once you've chosen your Call to Action, you’ll see the email preview update to reflect the question or button selected. 

VF03 email preview

Add Merge Fields and Personalize your Email

Add the merge fields that should be included in your survey. 

  1. Select the Salesforce object you'll be triggering your survey from. For example, if you're looking to send out a survey after closing a support case, select Case as your object. This selection helps GetFeedback pull in merge fields from the case such as case id, agent name to make sure we can map this information back to Salesforce when the survey has been submitted. This helps us track who submitted the survey, and ensures you can personalize the email and survey. 

VFMergeFields

- Next, select any other fields you'd like to bring into the URL of your survey.

VFOtherMergeFields

Now we’ve selected all the information we need to include in our survey URL before sending it from Salesforce: Case ID, Email address, and Account ID. By including this information, we're making sure the mappings we set up will work since we are now identifying which account this case is tied to, which case we’re referring to (case id), and the email address associated with the case. We could also add merge fields like the case owner to track the agent working on the case.

If you’ve set up a custom object to map your survey response to, you’ll want to make sure to include any lookup relationship information here. For example, if you have a lookup relationship between Case and Account, include the accountid here.

Now that you’ve added the merge fields to your survey you can add these merge fields to personalize your message. When the email is sent from Salesforce, it will automatically pull in this information for each email recipient.

Click on the blue Personalize button to get started and select the merge fields to pull into your template. Set up a fallback value, just in case.

PersonalizeVF

Prevent Duplicate Responses

Preventing duplicate responses requires adding one more merge field called gf_unique - to the VisualForce template. This merge field, associated with a unique identifier like Case ID or Contact ID, allows our system to recognize when a respondent has already taken a survey and prevents duplicate attempts.

Add gf_unique under the Additional Fields section of your email builder. In this section there are two fields to fill in: Merge Field Name and Merge Field Value

The merge field name is where you'll tell us what merge field you're using. In this case, you'll need to use gf_unique - as the merge field name.

gf_uniqueADDitionalFields

For the merge field value, if you want it to be dynamic, you'll use the Salesforce specific syntax for your identifier, and can retrieve this information from the merge fields you’ve already selected by clicking Show details and copying the Salesforce specific syntax.. You’ll find more information on using gf_unique in the help center.

Export Your Template

Now the email template is built, and you’ll want to get it into Salesforce so you can send it. You have two options, Copy & Close the Visualforce template code, or Send it as an email to your Salesforce admin to wrangle. 

VFExportCode

Create Your Visualforce Template in Salesforce

Armed with your Visualforce code, navigate to Set Up in your Salesforce org and create a new Visualforce template in your Classic Email Templates.

kA61J0000005okxSAA_en_US_1_11

Run through the Salesforce Visualforce template creator. 

  • Enter the subject line of your email, but keep in mind that this will be overwritten by the subject line you've created in your GetFeedback email template.

  • Select the recipient type and related object. 

  • Edit Template and Paste the Visualforce code into your template builder. Overwrite any text in the Email Content field.

kA61J0000005okxSAA_en_US_1_12

Send Your Email

  • Save the template. 

  • Preview the email, and send a preview to yourself to test the merge fields by clicking Send Test and Verify Merge Fields.

  • Choose a test Case to associate with the email to make sure those merge fields are working.

VFEmailPreview