[SalesForce] How to send one email on multiple email address within one data extension [Marketing Cloud]

I have one data extension named "SubscriberDE" with fields first_name (text 50), last_name(text 50), Email address(email), and Rep_email(text 50)

I configured a journey where once the subscriber click a link in [EMAIL 1] it will go through a engagement activity and go to the "YES" path and it will send CIM_Order_Details Email Activity to the subscriber email which is the field "Email Address (email) but i also need to send the same email to the Rep_email (text 50) field. Somehow its like a CC Email. (see below for the constructed Journey)

How would i be able to do that? Is it possible to do it on one Journey only?

I've read about Trigger send, Ampscript and soap API. Do i need to use that so i can send the email using rep_email field?

Bottom line is i want the same Email to be sent to email and rep_email fields together.

enter image description here

Best Answer

You have two options here

Option 1

Albeit this is not best practice, you could set a trigger send API call inside of the email (via SSJS or AMPscript) so that each time the email goes out it triggers the triggered email to send to your rep.

Please note this can cause delays to processing and is definitely not recommended for high volume emails.

AMPScript sample:

VAR @ts, @tsDef, @ts_sub, @ts_attr, @tsctr, @ts_subkey, @ts_statusCode, @ts_statusMsg, @owner, @client

//Create the triggered send and set the email address used for the send
SET @ts = CreateObject("TriggeredSend")
SET @tsDef = CreateObject("TriggeredSendDefinition")
SET @ts_subkey = RequestParameter("EmailAddress")

//Indicate the triggered send definition used to create the triggered send
SetObjectProperty(@tsDef, "CustomerKey", "yourTriggerKey")
SetObjectProperty(@ts, "TriggeredSendDefinition", @tsDef)

//Set the contact as the recipient for the triggered send
SET @ts_sub = CreateObject("Subscriber")
SetObjectProperty(@ts_sub, "EmailAddress", RequestParameter("Rep_Email"))

//Set the contact email address as the subscriber key
IF NOT EMPTY(@ts_subkey) THEN
    SetObjectProperty(@ts_sub, "SubscriberKey", @ts_subkey)
ELSE
    SetObjectProperty(@ts_sub, "SubscriberKey", RequestParameter("Rep_Email"))
ENDIF

SetObjectProperty(@ts_sub, "first_name", RequestParameter("first_name")
SetObjectProperty(@ts_sub, "last_name", RequestParameter("last_name")
SetObjectProperty(@ts_sub, "yourOtherFields", @otherFieldValues)

AddObjectArrayItem(@ts, "Subscribers", @ts_sub)
SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode)

IF @ts_statusCode != "OK" THEN
    RaiseError(concat(@ts_statusMsg,@ts_subkey,@ts), 0, @ts_statusCode, @errorCode)
ENDIF

SSJS sample: (simpler, but processes much slower)

var triggeredSend = TriggeredSend.Init("yourTriggerKey");
var status = triggeredSend.Send(rep_email, {first_name: first_name, last_name: last_name, ...});

Option 2

If it doesn't have to be 'real time' or adding in a trigger send script to the email is too unweildy, you could have an upsert inside of the Email that puts it into another DE and then have an automation that runs hourly to send that email (via User-Initiated send, not trigger) to the rep_email field instead of Email Address.

Basically something like this:

  1. Create DE with rep_email as the sendable field and use Email Address and rep_email as the primary keys.
  2. Inside this DE, include a field named 'Sent' with a default of N
  3. Create a UI email using the email from the trigger and use the newly created DE as the audience - I would use a filter (something like 'Sent' is equal to 'N')
  4. Create a SQL Query that updates the DE. Using the 'Update' method SELECT [Email Address], rep_email, 'Y' as Sent FROM yourDE targeting your new DE.
  5. Create a scheduled automation in Automation Studio that runs hourly with Step 1 being the UI and Step 2 being the SQL.

This should allow you to send a copy of the email to your reps within an hour after it was sent to the customer.

Related Topic