An integration in Salesforce sometimes generates a string of multiple email addresses separated by semicolons and stores it in a custom text field, such as Contact_Email_Address__c, on the Contact record. A common requirement is to extract just the first email address from that string and store it in the standard Email field on the Contact record.
This article explains how to meet that requirement using a formula resource inside a Salesforce Flow.
In this use case, as the Email value population needs to happen on creation of Contact record, we use a Record-Triggered Flow to automatically extract the first email address out of a semicolon-separated list. Follow the steps below to build the automation.
Login to your Salesforce account, click the Gear Icon on the top right corner of your screen, and select Setup.
From the Quick Find box, search for Flows and select the New Flow button.
Under the Categories section, choose the Triggered option, then select Record-Triggered Flow to proceed.
On the Configure Start trigger, provide the following values:
| Object | Contact |
| Trigger the Flow When | A record is created |
| Condition Requirement | All Conditions Are Met (AND) |
| Optimize the Flow for | Fast Field Updates |
Set the Logic as follows:
| Contact_Email_Address__c | Does Not Equal |
Note: Leave the Value input box empty in the logic above, since we don't want the Flow to trigger when Contact Email Address is blank.
Create a new Formula resource type for extracting the first email value from the Contact Email Address field. Substitute the values as follows:
| Resource Type | Formula |
| API Name | Provide a suitable API Name |
| Description | Provide a suitable Description |
| Data Type | Text |
Use the following formula:
`LEFT({!$Record.Contact_Email_Address__c} , FIND( ";" , {!$Record.Contact_Email_Address__c})-1)`
This formula finds the position of the first semicolon in the Contact Email Address string, then takes every character to the left of it — in effect isolating just the first email address in the list.
Add an Assignment element, available when the + icon is selected. Provide a suitable Label and Description — a Description is optional but considered a best practice.
| Label | Assign first email value |
| Description | Provide any suitable description |
Set Variable Values as below:
| {!$Record.Email} | Equals | {!Formula_ExtractEmail} |
On the upper right side of the Flow canvas, click the Save button and provide a suitable Flow Label.
Click the Activate button next to the Save button to activate the Flow.
____________________________________________________________________
Written by: Ajaypreet Singh Saini | Forum Ambassador
Ajaypreet Singh Saini is working as a Salesforce Implementation Consultant at Grantbook. Prior to Grantbook, Ajaypreet served as a Salesforce Administrator for 2 years working on Sales Cloud where he was responsible for configuring and administrating complex processes and maintaining security of Salesforce Instance.
Submissions reflect only the opinions of the user who made available the Submission and not the opinions of Salesforce, regardless of whether the user is affiliated with Salesforce, and may contain or constitute products, services, information, data, content and other materials made available by or on behalf of third parties ("Third Party Materials). Salesforce neither controls nor endorses, nor is Salesforce responsible for, any Third Party Materials, including their accuracy, validity, timeliness, completeness, reliability, integrity, quality, legality, usefulness or safety, or any applicable intellectual property rights. Any Submissions made available through any message board or forum in response to posted questions, or that otherwise purports to answer any questions, including any questions about Salesforce or Programs, are made available for your general knowledge only and should never be relied upon as answers to your specific questions (even if an answer is marked as a "best" answer or with any similar qualifications). You should always contact Salesforce support for answers to your specific questions. Salesforce has no control over Submissions, and is not responsible for any use or misuse (including any distribution) by any third party of Submissions.
If you have questions, tap into the wisdom of our entire Trailblazer Community here: https://trailhead.salesforce.com/trailblazer-community/feed
004754253

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.