Dynamic sender profile with the SF CRM Owner ID

A Sender profile is required to send an email in the Salesforce marketing cloud.

The profile enables you to specify and store the sender information in a central location where it can be automatically included in future emails without the information having to be enter and selected each time.

People are much more aware and wary of phishing attacks if they receive a suspicious email from a sender with an unfamiliar or strange email address. To avoid this situation, many organisations now prefer to use the email from address associated with their actual staff members. However, large numbers of staff can make it simply impractical to create hundreds of Sender Profiles for email communication, thus posing a problem for some organisations.

One powerful solution in the Salesforce marketing cloud is the use of the dynamic sender profile.

Today, multiple educational organisations use SF CRM where each email record has its owner, and the owner ID is related to each Lead object. In this case, the Lead record was created by the owner and the record owner requires that his/her email address and name to be used in all communications.

This article demonstrates how to create a Dynamic sender profile related to the Owner ID that is available in both Lead and Contact objects in Salesforce CRM.

Setting up a sender profile that dynamically populates the sender name and address in Salesforce Marketing Cloud can be a VERY useful and effective strategy for email communication.

STEP 1. Add the Owner ID attribute.

The attribute Owner ID should be added to the Profile Management.

STEP 2. Automate to populate the Owner ID attribute to each existing Lead.

Create and initiate automation to populate the Owner ID attribute to each existing Lead in All Subscribers.

The following SQL query was used to obtain Owner ID from SF CRM:

Select

l.id as Subscriberkey,
l.email as email,
s.status as status,
l.Ownerid as Ownerid
from Lead_Salesforce l join _subscribers s on l.id=s.SubscriberKey where l.email is not NULL

Next, the result can be placed into a data extension and imported to All Subscribers.

The Owner ID attribute will be populated to each subscriber.

Launch the Automation to populate the Owner ID attribute of each Lead or Contact.

STEP 3. Automatically identify new Leads who are not in All Subscribers and add them to All Subscribers.

The following SQL Query identifies new Leads who are not in All Subscribers:

SELECT id as SubscriberKey,
email as email,
case when HasOptedOutOfEmail = ‘False’ then ‘Active’
else ‘Unsubscribed’
end as status,

OwnerId as OwnerId
FROM [Contact_Salesforce]
WHERE id NOT IN
(SELECT Subscriberkey FROM _subscribers)
and email is not NULL

Schedule the automation to run daily.

STEP 4. Create two content blocks.


STEP 5. Populate EMAIL FROM content into Sender Profile Selection Email content block.

%%[
VAR @Dynamic_From_Email
IF @Ownerid == ‘005D0000001tNYwIXX’ THEN
SET @Dynamic_From_Email = “owner1@domain
ELSEIF
ownerid == ‘005D0000005eSDiIXX’ THEN
SET @Dynamic_From_Email = “owner2@domain
ELSEIF
ownerid == ‘005D0000002az59IXX’ THEN
SET @Dynamic_From_Email = “owner3@domain
ELSEIF
ownerid == ‘005D0000004jtQmIXX’ THEN
SET @Dynamic_From_Email = “owner4@domain
.
.
.
ELSE SET @Dynamic_From_Email = default@domain
ENDIF ]%%
%%=v(@Dynamic_From_Email)=%%

STEP 6. Populate NAME FROM content into Sender Profile Selection Name content block.

%%[
VAR @Dynamic_From_Name
IF @Ownerid == ‘005D0000001tNYwIXX’ THEN
SET @Dynamic_From_Name = “Owner1 name”
ELSEIF
ownerid == ‘005D0000005eSDiIXX’ THEN
SET @Dynamic_From_Name = “Owner2 name”
ELSEIF
ownerid == ‘005D0000002az59IXX’ THEN
SET @Dynamic_From_Name = “Owner3 name”
.
.
.
ELSE SET @Dynamic_From

_Name = Default Name
ENDIF ]%%
%%=v(@Dynamic_From_Name)=%%

STEP 7. Determine the Content area ID for each content area.


STEP 8. Create a new Sender Profile and assign it a name in the Dynamic Sender Profile or another locations.

Select “Use the specified information radio button”.

STEP 9. Place AMPscript into your template or in the email header.

Add the following AMPscript to each email:

%%[
var @Ownerid
set @Ownerid = AttributeValue(“OwnerId”)
]%%

This code obtains the value of the Owner ID attribute, which can be placed in a template to be used to create an email with a Dynamic Sender Profile.

Once all the steps above are completed you can send your email using a newly created dynamic sender profile.

Thank you for reading!

Please get in touch: support@sfmctoolbox.com