Skip to content

Instantly share code, notes, and snippets.

View deduplicate_subscribers.sql
SELECT contact.Email,
contact.Id
FROM /*data extension name*/ contact
INNER JOIN (
SELECT Email,
MAX(Id) AS Id
FROM /*data extension name*/
GROUP BY Email
) aggr
ON aggr.Email = contact.Email AND aggr.Id = contact.Id
View deduplicate_synched_Contacts.sql
SELECT contact.Email,
contact.Id
FROM ent.Contact_Salesforce contact
INNER JOIN (
SELECT Email,
MAX(Id) AS Id
FROM ent.Contact_Salesforce
GROUP BY Email
) aggr
ON aggr.Email = contact.Email AND aggr.Id = contact.Id
View batchcontactevents.json
Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com
POST /interaction-experimental/v1/batchcontactevents
Content-Type: application/json
Authorization: Bearer YOUR_V1_ACCESS_TOKEN
{
"EventDefinitionKey":"{{API entry event key}}",
"BatchId":"",
"RecordCount":2,
View campaign-journey-payload.json
*****2020-11-12 16:51:04.337|HTTP RESPONSE|"6ffc2d53-c97e-4a89-bd66-535cxxxxx"
*****2020-11-12 17:02:29.36|HTTP CALLOUT|FireJourneyBuilderEvent
*****2020-11-12 17:02:29.46|HTTP REQUEST|https://mcxxxxx.rest.marketingcloudapis.com/interaction-experimental/v1/batchcontactevents
{
"EventDefinitionKey":"SalesforceObjcbd44d55f8f9df29b0f5631xxxxxx",
"ContactPersonType":"CampaignMember",
"CallerSystemName":"Salesforce",
"BatchId":"",
"RecordCount":2,
View formAMPscriptMultiSelectPicklist.html
<script runat="server">
Platform.Load("Core","1.1.1");
try{
</script>
%%[
IF RequestParameter("submitted") == true THEN
SET @preferences = CONCAT(
Iif(RequestParameter("newsletters") == "on", "Newsletters;", ""),
Iif(RequestParameter("events") == "on", "Events;", ""),
View updateMultiSelectPicklist.html
SET @preferences = CONCAT(
Iif(RequestParameter("newsletters") == "on", "Newsletters;", ""),
Iif(RequestParameter("events") == "on", "Events;", ""),
Iif(RequestParameter("offers") == "on", "Special Offers;", ""),
Iif(RequestParameter("surveys") == "on", "Surveys;", ""),
Iif(RequestParameter("promotions") == "on", "Promotions", ""),
)
if not Empty(@preferences) then
SET @updateRecord = UpdateSingleSalesforceObject(
View HTMLformAMPscriptPicklistCheckboxes.html
%%[
set @subscriberKey = AttributeValue(_subscriberKey)
set @subscriberRows = RetrieveSalesforceObjects(
"Contact",
"FirstName,LastName,Email,Preferences__c",
"Id", "=", @subscriberKey )
if RowCount(@subscriberRows) == 1 then /* there should only be one row */
var @subscriberRow, @firstName, @lastName, @email
set @subscriberRow = Row(@subscriberRows, 1)
View HTMLformWithMultiSelectPicklistData.html
<h2>Please fill in the form:</h2>
<form action="%%=RequestParameter('PAGEURL')=%%" method="post">
<label>First name: </label><input type="text" name="firstname" required="" value="%%=v(@firstName)=%%"><br>
<label>Last name: </label><input type="text" name="lastname" required="" value="%%=v(@lastName)=%%"><br>
<label>Email: </label><input type="text" name="email" required="" value="%%=v(@email)=%%"><br><br>
<h2>Update your subscriptions:</h2>
<input name="newsletters" type="checkbox" %%=v(@Newsletters)=%%><label>Newsletters</label><br>
<input name="events" type="checkbox" %%=v(@Events)=%%><label>Events</label><br>
<input name="offers" type="checkbox" %%=v(@Offers)=%%><label>Special Offers</label><br>
<input name="surveys" type="checkbox" %%=v(@Surveys)=%%><label>Surveys</label><br>
View loopMultiSelectPicklistValues.html
%%[
set @subscriberKey = AttributeValue(_subscriberKey)
set @subscriberRows = RetrieveSalesforceObjects(
"Contact",
"FirstName,LastName,Email,Preferences__c",
"Id", "=", @subscriberKey )
if RowCount(@subscriberRows) == 1 then /* there should only be one row */
var @subscriberRow, @firstName, @lastName, @email
set @subscriberRow = Row(@subscriberRows, 1)
You can’t perform that action at this time.