1

The scenario is this:

We are using the SFMC connector to create a Data extension with contacts to receive communications. The subscriber key for this Data extension is Salesforce ID.

In parallel to this Data Extension, there is another one that is fed with data from a Cloudpage. The Subscriber Key of this DE is no longer the Salesforce ID (for example the email) because the registration enters through the Landing page. After submitting the form on the cloudpage, a thank you email is sent to this contact, creating a record on All subscribers with this Subscriber Key.

What will be the best approach in this case so that there is no duplication of contacts in All subscribers, because a contact may already be part of this list identified through Salesforce ID.

If I unsubscribe to an email associated with a Subscriber Key, will the same email contact using a different Subscriber Key also stop receiving emails?

1

The best approach here would be to avoid having different subscriber keys directly at source. What you need to do to avoid this, is to have your Cloud Page create a contact in Sales Cloud instead of creating it in a Data Extension. This will ensure you only use Contact ID as Subscriber Key, and avoid duplicates. Additional benefit would be having a complete overview of all your records in Sales Cloud. Currently, there will be individuals who are created in Marketing Cloud, and not known in Sales Cloud.

I will suggest following approach, based on a submission of a custom form on your Cloud Page:

%%[
VAR @Email, @ContactID, @FirdstName, @LastName
SET @LookUp = RetrieveSalesforceObjects('Contact', 'Id, FirstName, LastName', 'Email', '=', @Email)
IF RowCount(@LookUp) > 0 then
    SET @CRMRow = Row(@LookUp,1) 
    SET @ContactID = Field(@CRMRow, 'Id')
ELSE
    SET @ContactID = CreateSalesforceObject('Contact', 3, 'FirstName', @FirstName, 'LastName', @LastName, 'Email', @Email)
ENDIF
]%%

Above code will also ensure you don't create a new record if a record with same email address already exists. You must of course ensure to pass the form values to ampscript variables appropriately.

You can choose to use single send journey in Journey Builder to send the email, upon creation of a new Contact record, ensuring you will still be able to communicate in near real time with the person submitting the form, however you will need to pass an additional "flag" to a custom field on the contact, which will distinguish creation/update of a contact eligible for that given email, from other contacts created/updated.

Alternatively, you can use AmpScript to send a triggered email, by adjusting this example made by Zuzannamj (source). You should pass @email and @contactid parameters from the lookup/create code above:

%%[
VAR @ts, @tsDef, @ts_extkey, @ts_email, @ts_sub, @ts_statusCode, @ts_statusMsg, @errorCode
SET @ts = CreateObject("TriggeredSend")
SET @tsDef = CreateObject("TriggeredSendDefinition")
SET @ts_extkey = "ExternalKey"
SET @ts_email = @Email
SET @ts_subkey = @ContactID

SetObjectProperty(@tsDef, "CustomerKey", @ts_extkey)
SetObjectProperty(@ts, "TriggeredSendDefinition", @tsDef)
 
SET @ts_sub = CreateObject("Subscriber")
SetObjectProperty(@ts_sub, "EmailAddress", @ts_email)
SetObjectProperty(@ts_sub, "SubscriberKey", @ts_subkey)
AddObjectArrayItem(@ts, "Subscribers", @ts_sub)

SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode)
IF @ts_statusCode != "OK" THEN
RaiseError(@ts_statusMsg, 0, @ts_statusCode, @errorCode)
ENDIF
]%%
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.