Loading

Sending Automated Emails to Primary Contact Roles When an Opportunity is Won

Data pubblicazione: Apr 21, 2026
Descrizione

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.

Risoluzione

Step 1: Create the Record-Triggered Flow

First, set up a Flow that triggers when an Opportunity is marked as "Closed Won."

  1. Navigate to Setup > Flows and click New Flow.

     
  2. Select Record-Triggered Flow.

  3. Configure the trigger:

  • Object: Opportunity
  • Trigger the Flow When: A record is updated
  • Condition Requirements: All Conditions Are Met (AND) 
      • StageName Equals Closed Won

      • IsWon Equals $GlobalConstant.True

  • When to Run the Flow for Updated Records: Only when a record is updated to meet the condition requirements 
  • Optimize the Flow for Actions and Related Records.

     

 

Step 2: Get the Primary Contact
Next, add an element to find the primary contact associated with the Opportunity.

  1. On the Flow canvas, add a Get Records element.

  2. Label: Get Primary Contact Role

  3. Object: Opportunity Contact Role
  4. Filter by:

      • OpportunityId Equals $Record.Id

      • IsPrimary Equals $GlobalConstant.True

  5. How Many Records to Store: Select Only the first record.
  6. How to Store Record Data: Select Automatically store all fields.


 

Step 3: Add the "Send Email" Action

Finally, add an action to send the email directly to the contact you just found.

  1. Add a Decision element to check if a Primary Contact was found in the previous step.

  2. If found, add an Action element.

  3. In the Action search bar, select Send Email.

  4. 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}.

  5. Click Done.

  6. Save and Activate your Flow.

     

Numero articolo Knowledge

000389981

 
Caricamento
Salesforce Help | Article