Loading
Salesforce now sends email only from verified domains. Read More
Automate Your Business Processes
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Get Contacts and Leads from Email Addresses Action

          Get Contacts and Leads from Email Addresses Action

          This action matches email addresses to contact and lead records related to active user records. To be used in the Activities: Match Email to Records flow. Requires that Sync Email as Salesforce Activity is enabled in Einstein Activity Capture.

          Required Editions

          Available in: Lightning Experience
          Available with Einstein Activity Capture Standard in Sales Cloud in Starter, Professional, and Enterprise Editions
          Available with Unlimited Edition and Einstein 1 Sales Edition
          Available with Einstein for Sales, which is included in Einstein 1 Sales Edition, and available for an extra cost in Enterprise and Unlimited Editions.
          Available with Sales Engagement in Sales Cloud, which is included in Performance and Unlimited Editions, and available for an extra cost in Professional and Enterprise Editions.
          Available with Revenue Intelligence, which is available for an extra cost in Enterprise and Unlimited Editions.

          In Flow Builder, add an Action element to your flow. In the New Action window, search for Activities Match, and then select Get Contacts and Leads from Email Addresses.

          Set Input Values

          Use values from earlier in the flow to set the inputs for the action.

          Field Description
          Account Field The name of the field you use to identify partner accounts. Optional if Partner Accounts is false. This input is captured in the Uses Partner Accounts section of action properties in Flow Builder.
          Activity ID Optional. The ID of the email message to associate with the specified records.
          Comparison Operator The comparison operator to determine a partner account. Valid values are Equals, Does Not Equal, Greater Than, Less Than, Greater Than or Equal, Less Than or Equal, Is Null, and Is Blank. Optional if Partner Accounts is false. This input is captured in the Uses Partner Accounts section of action properties in Flow Builder.
          Email Addresses Required. A collection of email addresses that don't have a corresponding active user record.
          Partner Accounts A Boolean value that indicates whether the business has partner accounts. The default value isfalse. This input is captured in the Uses Partner Accounts section of action properties in Flow Builder.
          Users Required. A collection of active user records to help determine related contact and lead records to match emails to. These user records contain an email address in the From, To, or CC of the email message.
          Value The value of the Account Field to identify a partner account. Optional if Partner Accounts is false. This input is captured in the Uses Partner Accounts section of action properties in Flow Builder.

          Store Output Values

          Field Description
          Account Field The name of the field you use to identify partner accounts.
          Comparison Operator The comparison operator to determine a partner account. Valid values are Equals, Does Not Equal, Greater Than, Less Than, Greater Than or Equal, Less Than or Equal, Is Null, and Is Blank.
          Contacts A collection of contact records that matched email addresses for contacts.
          Leads A collection of lead records that matched email addresses for leads.
          Partner Accounts A Boolean value that indicates whether the business has partner accounts. The default value is false.
          Unmatched Email Addresses A collection of email addresses that didn't match a contact or lead record.
          Value The value of the Account Field to identify a partner account.

          Error Conditions

          Error Condition Description
          No Account Field

          If Partner Accounts is true, specify an account field for partner account criteria.

          Error Code: REQUIRED_FIELD_MISSING

          No Comparison Operator

          If Partner Accounts is true, specify a comparison operator for partner account criteria.

          Error Code: REQUIRED_FIELD_MISSING

          No Value

          If Partner Accounts is true, specify a value for partner account criteria.

          Error Code: REQUIRED_FIELD_MISSING

          Usage

          To use this action, you must enable Sync Email as Salesforce Activity. The action is designed mainly to be used within the Activities: Match Email to Records flow.

          How It Works

          This action uses as input the email message ID, email addresses that don’t match a user record, and user records that match an email address in From, To, or CC in the message. If you use partners in your sales process, the Partner Accounts, Account Field, Comparison Operator, and Value fields capture the criteria you use to indicate partner accounts. Set the values for these fields in the Uses Partner Accounts section of action properties in Flow Builder.

          The action queries the Email field in Contact records to find the records that correspond to email addresses in action input. The list of user records is used to help as a tiebreaker when multiple contacts are found.

          After finding contact records, the action queries the Email field in Lead records to match remaining email addresses to a lead. Email addresses that don’t match a contact or lead are stored in Unmatched Email Addresses in output.

          Contact Tiebreakers

          If multiple contacts match an email address, the action follows this logic.

          First, the action checks the RecordTypeId field on each of the contacts’ accounts. The action queries the Name field in the RecordType object. If the Name isn’t a partner for all matching contact records, then the action assumes that it’s a non-partner account. Similarly, if the Name is a partner for all matching contact records, then the action assumes that it’s a partner account. To determine the contact, the action evaluates these rules in order.

          • If there are more than 10 contacts for the same email address, the action picks the contact with the most recent LastActivityDate. The action adds that contact to Contacts in action output.
          • If a contact’s account owner matches a user record in Users in action input, then the action picks that contact and adds it to Contacts in action output.
          • If a contact’s owner matches a user record in Users in action input, then the action picks that contact and adds it to Contacts in action output.
          • If the prior rules didn’t result in a contact added to output, then the action picks the contact that was most recently modified. The action adds that contact to Contacts in action output.

          Second, if matching contact records have a mix of partner and non-partner values for the Name field in the RecordType object, then the action evaluates these rules in order.

          • If another contact matches a different email address in the email, and that contact belongs to a non-partner account, then the action ignores the non-partner contacts. To determine the contact, the action uses the partner contacts and evaluates them according to the contact tiebreaker rules. The action adds the result to Contacts in action output.
          • If the prior rule didn’t result in a contact added to output, then the action uses the non-partner contacts and evaluates them according to the contact tiebreaker rules. The action adds the result to Contacts in action output.

          Lead Tiebreakers

          If an email address didn’t match any contacts, then the action attempts to match it to a lead. If multiple leads match an email address, the action follows this logic.

          • If a lead’s owner matches a user record in Users in action input, then the action picks that lead and adds it to Leads in action output.
          • If the prior rule didn’t result in a lead added to output, then the action picks the lead that was most recently modified. The action adds that lead to Leads in action output.

          Limitations

          This action is limited to usage within a flow. It can't be invoked through other methods such as Apex, REST API, Copilot, Prompt Studio, or Einstein Bots. While actions can typically be invoked through various frameworks like InvocableActionService, this specific action is restricted solely to Flow.

          If the activityId field is empty when debugging this action, use the Developer Console to query StagedEmail for a value.

           
          Loading
          Salesforce Help | Article