Let's look at a business scenario. Sara Bareilles, who is working on the Flow Displaying feedback form based on age, received a new requirement to send a thank you e-mail to participants on their successful completion of a survey. To implement this, follow these instructions:
-
Click on the Resource tab and add Text Template to create an e-mail template. Enter Unique Name as EmailTemplate and create an e-mail template, as shown in the following screenshot. You can also use an HTML tag here:
- Once you are done, click on the OK button.
- Now we will use the Send Email static action to send out an e-mail to participants. Click on the Palette tab and drag and drop the Send Email static action onto the canvas; this will open a new window, where you have to enter the following details:
- Name: Enter the Name field for the Send Email element. In this case, enter Thank you email as Name.
- Unique Name: This will be autopopulated based on the name.
- Inputs: Enter text in Body for the e-mail. In this case, use Text Template that we created in previous steps. For Subject, enter Thank you for completing our survey!. For Email Addresses (comma-separated), select {!Email_Address} screen input fields. If you want to use an organization-wide e-mail address instead of a current user's e-mail address to send an e-mail, add Sender Type as OrgWideEmailAddress and Sender Address as the organization-wide e-mail address that is used to send the e-mails. If you are using organization-wide email addresses to send out an e-mail, you have to enter the organization-wide e-mail address in Sender Address.
This is shown in the following screenshot:
- Once you are done, click on the OK button.
To find the organization-wide e-mail address for the current organization, navigate to Setup | Administer | Email Administration | Organization-Wide Addresses.
- Use the connector to connect the Record Create element and the Send Email static action with the rest of the Flow, as shown in the following screenshot:
- Save your Flow and close the Flow Designer using the Close button; this will redirect you to the Flow Detail page. Don't activate the Flow now; as a system administrator, you can test it without activating it.
- To test this Flow, click on the Run button and enter the date 1/29/1984. Then, click on the Next button, fill in all the details and check your e-mail inbox (remember, you have to enter your e-mail address on the survey page). You should receive an e-mail that looks similar to what is shown in the following screenshot:
- Navigate to the Survey tab and check the record created by the Flow:
In Chapter 4, Debugging and New Ways to Call a Flow, you will learn the ways to expose this Flow for unauthenticated access using the Force.com site and the Visualforce page.