Salesforce Automated Gifting
How a Salesforce Trigger Sends an Email
A practical walkthrough using a Record‑Triggered Flow in Salesforce (the modern replacement for Process Builder) to send an email when conditions are met. Includes steps, “gotchas,” and screenshot placeholders you can replace with your own captures. Greetabl Insider Pro pays for itself when sending five or more gifts per month, subscribe now!
Prerequisites & what you’ll build
- Salesforce org with permission to create Email Templates and Flows.
- Lightning Experience enabled (UI paths assume Lightning).
- An org‑wide email address or verified From address (Setup → Email → Org‑Wide Addresses), if required by your template/alert.
You’ll build a Record‑Triggered Flow that watches for a trigger (e.g., Lead is created; Opportunity stage changes) and then sends an email using either a Lightning Email Template or an Email Alert.
Flow at a glance
Step 1 — Create an Email Template
- Go to App Launcher → Email Templates (or Setup → Feature Settings → Sales → Email → Lightning Email Templates).
- Click New Email Template, choose a folder, and set the Related Entity Type (Lead, Contact, etc.).
- Write your subject and body. Use merge fields (e.g.,
{{!Lead.FirstName}}
) as needed. - (Optional) Attachments or enhanced letterhead if your org uses it.
- Save and ensure the folder access suits who will run the flow.
Tip: If you prefer classic Email Alerts, you can also create a Classic template (Setup → Classic Email Templates) and reference it from an Email Alert.
Step 2 — (Option A) Create an Email Alert
You can either invoke the Flow action Send Email directly (no Email Alert required) or create an Email Alert and call that from Flow. Email Alerts are handy if admins will reuse the same message across automations.
- Go to Setup → Process Automation → Email Alerts.
- Click New Email Alert, select your object, template, recipients (e.g., Email field on record, owner, specific addresses), and From address.
- Save.
Step 3 — Build a Record‑Triggered Flow
- Go to Setup → Process Automation → Flows → New Flow.
- Select Record‑Triggered Flow.
- Pick the Object (e.g., Lead) and choose when to trigger: A record is created, updated, or both.
- Set the Entry Conditions (e.g., Lead Source = "Web"), and choose to run Fast Field Updates or Actions and Related Records (choose the latter if sending email).
- Click Done.
Step 4 — Add the Send Email action
- From the Flow canvas, click + to add an element.
- Choose either Action → Email Alerts (then select your alert), or Action → Send Email.
- If using Send Email: specify Recipient Addresses (e.g., {!$Record.Email}), Subject, and Body (or reference the Lightning Email Template via Email Template, depending on your org features).
- (Optional) Add a Decision element before the action to branch by conditions (e.g., country, product interest).
Step 5 — Test & Activate
- Click Save, then Debug on the Flow to run with a sample record and confirm the email step executes.
- Click Activate.
- Create or update a record that matches your trigger and confirm the email is sent. Check Setup → Email Log Files (if enabled) or the record’s activity timeline.
Troubleshooting & FAQs
- Send Email vs. Email Alert? Use Send Email for quick inline sends in Flow; use Email Alert if you want admins to swap templates/recipients without editing the Flow.
- Template doesn’t appear: Check folder permissions and that the Related Entity Type matches your record.
- No email sent: Ensure your Flow runs in Actions and Related Records context (not Fast Updates), the condition actually matches, and From/To addresses are valid. Check Flow error emails, email logs, and deliverability settings.
- Sandbox vs. Production: Copy templates and alerts via Change Sets or deploy with your preferred tool. Test in a sandbox first.
- Compliance: For marketing‑like sends, consider Marketing Cloud/Account Engagement. For operational messages, ensure consent requirements are met.
Example: New Lead → immediate email
Send a welcome email when a Lead is created with Source = Web.
- Email Template: "Welcome to Greetabl — Let’s Get Started" (Lightning Email Template, Related Entity: Lead).
-
Flow: Record‑Triggered on Lead, A record is created, Entry Condition
LeadSource = Web
, Run in Actions and Related Records. -
Action: Add Send Email → Recipient
{!$Record.Email}
→ Subject/body (or reference template) → Save. - Activate and test by creating a Lead with Lead Source = Web.
Trigger: Lead is created (LeadSource = Web)
└─ Action: Send Email (To: {!$Record.Email}, Template: Welcome)
Salesforce features and names can vary by release. If a control looks different, check the latest Salesforce Help.