This article explains how to build a Record-Triggered Flow in Agentforce Sales, formerly known as Sales Cloud that automatically sends an email to the primary Contact Role when a related Opportunity's stage is set to 'Closed Won.' This is useful when sales teams need to notify key contacts immediately upon deal closure without manual intervention. Note: The email will only be sent if the Contact Role on the Opportunity has been marked as Primary.
For example, a sales manager wants the primary deal contact to automatically receive a congratulatory email with Opportunity details the moment a rep marks a deal as Closed Won, without any manual steps.
First, set up a Flow that triggers when an Opportunity is marked as "Closed Won."
Navigate to Setup > Flows and click New Flow.
Select Record-Triggered Flow.
Configure the trigger:
Opportunity A record is updated All Conditions Are Met (AND) StageName Equals Closed Won
IsWon Equals $GlobalConstant.True
Only when a record is updated to meet the condition requirements Optimize the Flow for Actions and Related Records.
On the Flow canvas, add a Get Records element.
Label: Get Primary Contact Role
Opportunity Contact RoleFilter by:
OpportunityId Equals $Record.Id
IsPrimary Equals $GlobalConstant.True
Finally, add an action to send the email directly to the contact you just found.
Add a Decision element to check if a Primary Contact was found in the previous step.
If found, add an Action element.
In the Action search bar, select Send Email.
Configure the email:
Body: Create a new Text Template resource for your email content. You can use merge fields like {!$Record.Name} to include Opportunity details.
Subject: Enter your desired subject line (e.g., "Opportunity Won: {!$Record.Name}").
Recipient Email Addresses (comma-separated): This is the most important step. Use the email from the contact you found in Step 2: {!Get_Primary_Contact_Role.Contact.Email}.
Click Done.
Save and Activate your Flow.
000389981

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.