Skip to main content

Add Merge Fields Within Your Surveys

Maria wants to create a brand-new two-question survey for customers who contact Ursa Major Solar’s support team, and add merge fields within the survey. Merge fields resolve data that’s already available in your Salesforce org.

Maria wants to use merge fields to resolve with information about:

  • The service agent who interacts with the customer.
  • The name of the customer.
  • An email ID that the customer can write to in case the customer has further queries.
  • Name of the company.

Configure Merge Fields

Maria is confident about the merge fields she wants to include within the survey. She plans to include the merge fields within the welcome message and questions. To help format the survey content better, she decides to configure the merge fields first, and then insert the merge fields while entering the content.

  1. From the App Launcher, find and select Surveys.
  2. Click New.
  3. Enter Post-Chat Feedback in the New survey window.
  4. Select Standard Survey and click Continue.
  5. Click Advanced Settings, and select Merge Field Variables.
  6. Select the access level as User Context - Enforce all user permissions. This access level ensures that merge fields only resolve to information which the customer has access to.
  7. Expand Object Variables for Merge Fields.
  8. In the Associated Object section, complete these fields:
    • Variable Name: CaseDetails
    • Object: Case
      Maria will insert a merge field that selects the name of the service agent from the case record that’s created when the customer starts a chat session.
  1. Click Save in the Associated Object section.
  2. In the Participant Objects section, complete these fields:
    • Variable Name: ParticipantDetails
    • Object: Contact
      Maria will insert a merge field that selects the name of the customer from the customer’s contact record.
  1. Click Save in the Participant Object section.
  2. Expand Org and Custom Variables.
  3. Click New Variable.
  4. Complete these fields:
    • Variable Name: CompanyName
    • Variable Type: Org
    • Variable Value: Name
  1. Click Save.
  2. Click New Variable.
  3. Complete these fields:
    • Variable Name: EmailId
    • Variable Type: Custom
    • Variable Value: support@example.comMerge field variables.
  1. Click Save.
  2. Click Back to Builder.

Insert Merge Fields

Maria must now add the content of the survey and insert the merge fields within the context.

  1. Within the rich text editor of the Welcome page, enter: Hello.
  2. Add a space after Hello, and click Insert Content.
  3. Select Merge field from a participant record, and click Next.
  4. In the Participant Variable field, select Full Name.
  5. Click Insert.
  6. At the end of the merge field, insert a comma.
  7. Add a space after the comma, and enter this text, including a period at the end: help us improve by taking this one-minute survey
  8. Enter a line break, and enter: For any other queries, contact
  9. Add a space after contact, and click Insert Content.
  10. Select Merge field from a custom variable, and click Next.
  11. In the Custom Variable field, select EmailId.
  12. Click Insert.
  13. At the end of the merge field, add a period.
  14. Cut the following text from the rich text editor: For any other queries, contact {!EmailId}.
  15. Paste the text in the description area. Merge fields can only be inserted within the description or within a question’s answer choice by copying it from the rich text editor or manually entering it.

Merge fields on the Welcome page.

Next, Maria needs to insert merge fields within the survey questions.

  1. Click Add Page.
  2. Click Add Question, and select Rating.
  3. Enter this text: How was your experience interacting with our support agent,
  4. Add a space after the comma, and click Insert Content.
  5. Select Merge field from an associated record, and click Next.
  6. In the Associated Object Variable field, select Owner ID(User) > First Name.
  7. Click Insert.
  8. At the end of the merge field, add a question mark.
  9. Click Add Question, and select Like or Dislike.
  10. Enter this text: Would you like to purchase another product from
  11. Add a space after from, and click Insert Content.
  12. Select Merge field from an org variable, and click Next.
  13. In the Org Variable field, select CompanyName.
  14. Click Insert.
  15. At the end of the merge field, add a question mark.
  16. Click Select an icon pair…
  17. Select Yes or No.
  18. Click Thank You Page.
  19. Enter: Hope we were able to help you today. Thanks for participating!
  20. Click Save.

Preview the Merge Fields

Maria is inserting merge fields in a survey for the first time. She wants to preview how merge fields resolve when customers actually view the survey.

Note

Your Trailhead Playground may not contain any Case or Contact records. You can create Case and Contact records if you want to complete the next set of steps. You won’t be tested on these steps.

  1. Click Preview.
  2. In the Associated Objects section, select a Case record.
  3. In the Participant Object section, select a Contact record.Merge field values for preview window with a Case and Contact record selected.
  4. Click Preview.

Maria previews the survey. On the Welcome page, the merge fields resolve to the contact’s name that Maria selected, and the email Id. On the next page, the merge fields resolve to the support agent’s name and the company’s name. Maria is very happy with the results.

She next moves on to create a survey data map that creates an Opportunity record every time a customer responds with Yes to the questions that check if they want to purchase another product from Ursa Major Solar.

Resources

在 Salesforce 帮助中分享 Trailhead 反馈

我们很想听听您使用 Trailhead 的经验——您现在可以随时从 Salesforce 帮助网站访问新的反馈表单。

了解更多 继续分享反馈