An organization-wide email address enables users to send emails using a shared display name and email address. This is particularly useful for Salesforce orgs where users share a common email alias. You can define a list of organization-wide email addresses for each profile or permission set, including unmonitored mailboxes that require a verified address. It is also possible to send emails using org-wide email addresses in Salesforce Flow. Although it is a straightforward solution, there is one important consideration if you are displaying org-wide email address options: some profiles may not have access to use a specific org-wide email address!
How to Send an Email from an Org-Wide Email Address in Flow
There are multiple ways to send an email in Flow and one of them is the Send Email core action. In order to send an email from an organization-wide email address, you have to set the "Sender Email Address" and "Sender Type" input parameters.
As you can see, you have to write "OrgWideEmailAddress" to the Sender Type and the org-wide email address to the Sender Email Address.
Displaying Organization-Wide Email Address Choices to the User
If you are using a Screen Flow, you may want to display organization-wide email addresses and allow the user to select one. However, it is important to ensure that only the organization-wide email addresses the user has access to are displayed. For instance, if the user's profile is not "Sales" or "System Administrator," they should not be able to see or select the "SFT Sales" org-wide email address.
First off, organization-wide email addresses are stored in OrgWideEmailAddress object. However, if you create choices directly using this object, it will include all the organization-wide email addresses, regardless of the user’s access.
In order to display the org-wide email addresses that the user has access to, you have to use another object called OrgEmailAddressSecurity. This object stores the org-wide email address and the allowed profiles. Note that any users assigned to those org-wide email addresses via permission set aren’t returned.
Building the Flow
Let's build a screen flow to display the org-wide email addresses that the user has access to.
1- Add a Get Records element to find the organization-wide email addresses that the user has access to.
2- Use a Transform element to create a text collection of org-wide email address Ids.
3- Use a Get Records element to find the organization-wide email addresses that the user has access to.
Then create a collection choice set using the records that you found.
4- Add a Screen element with one of the selection components. Let's use a radio button for this.
5- Add a Send Email action and set the relevant input values.
POC
The flow looks like this after adding some fault paths.
Let's debug the flow as different users.
Here is how a user with System Administrator profile sees the screen.
Here is how a user with another profile sees the screen. As you can see, they cannot choose/see the SFT Sales org-wide email address.
Leave a Reply