Skip to content

Instantly share code, notes, and snippets.


Adam Spriggs wvpv

View GitHub Profile
wvpv / sfmc-ampscript-two-click-unsubscribe.html
Last active Mar 18, 2022
SFMC two-click unsubscribe page
View sfmc-ampscript-two-click-unsubscribe.html
<script runat="server" language="ampscript">
set @debug = 0
set @unsubscribeFromAll = RequestParameter("unsubscribeFromAll") /* append this in the CloudPagesURL function, if desired */
set @submitFlag = RequestParameter("submitFlag")
/* on page load (pre-submit) */
if empty(@submitFlag) then
/* retrieve values from encrypted qs parameter send context */
wvpv / sfmc-ssjs-clear-de-wsproxy.js
Created Feb 15, 2022
SFMC Clear a Data Extension using WSProxy
View sfmc-ssjs-clear-de-wsproxy.js
<script runat="server" language="javascript">
var prox = new Script.Util.WSProxy();
var DEKey = "YourDEKey";
var clearDEResponse = prox.performItem("DataExtension",{"CustomerKey": DEKey},"ClearData");
wvpv / sfmc-republish-triggers-by-folder.js
Created Jan 6, 2022
Republish Triggered Send Definitions recursively by folder
View sfmc-republish-triggers-by-folder.js
<script runat="server">
var debug = false;
var logDE = DataExtension.Init("republish_trigger_log");
try {
/* CONFIG */
var parentCategoryID = 1264; // Triggered Sends
wvpv / sfmc-republish-trigger-log.csv
Created Jan 6, 2022
SFMC Republish Trigger script log
View sfmc-republish-trigger-log.csv
FieldName DataType Length Precision Scale PrimaryKey Required DefaultValue
TriggeredSendCustomerKey Text 36 FALSE FALSE
Key Text 100 FALSE FALSE
insertedDate Date FALSE FALSE getDate()
wvpv / sfmc-triggeredsendsummary-soap-object-retrieve-to-de.js
Created Dec 28, 2021
Retrieve TriggeredSendSummary SOAP object data and write to a Data Extension
View sfmc-triggeredsendsummary-soap-object-retrieve-to-de.js
<script runat="server">
var debug = false;
try {
var prox = new Script.Util.WSProxy();
// credit Jason Hanshaw:
wvpv / TriggeredSendSummary.csv
Created Dec 28, 2021
SFMC TriggeredSendSummary SOAP Object schema
View TriggeredSendSummary.csv
FieldName DataType Length Precision Scale PrimaryKey Required DefaultValue
Client_ID Number TRUE TRUE
TriggeredSendDefinition_ObjectID Text 36 TRUE TRUE
ObjectID Text 36 TRUE TRUE
Name Text 100 TRUE TRUE
CustomerKey Text 36 TRUE TRUE
seq Number TRUE TRUE
SenderProfile_Name Text 100 FALSE FALSE
SendClassification_Name Text 100 FALSE FALSE
RowObjectID Text 36 FALSE FALSE
wvpv / sfmc_sql_subscribers_all_summary.sql
Created Jan 27, 2021
Summary of subscriber statuses by business unit
View sfmc_sql_subscribers_all_summary.sql
, s.businessUnitName
, s.status
, count(*) count
from subscribers_all s
group by
, s.businessUnitName
, s.status
wvpv / sfmc_sql_subscribers_all_unsubs.sql
Created Jan 26, 2021
SFMC unsubscribes per business unit
View sfmc_sql_subscribers_all_unsubs.sql
u.BusinessUnitID businessUnitMID
, u.SubscriberKey
, u.subscriberId
, 'unsubscribed' Status
, u.UnsubDateUTC DateUnsubscribed
, case
when u.businessUnitID = 1 then 'Business Unit Name 1'
when u.businessUnitID = 2 then 'Business Unit Name 2'
when u.businessUnitID = 3 then 'Business Unit Name 3'
wvpv / sfmc_sql_subscribers_all.sql
Created Jan 26, 2021
SFMC all subscribers in all business units
View sfmc_sql_subscribers_all.sql
, s.SubscriberKey
, s.Status
, s.EmailAddress
, s.DateUnsubscribed
, s.DateJoined
, s.DateUndeliverable
, b.businessUnitMID
, b.businessUnitName
View sfmc-ampscript-baby-shark-multiple-concat-loop.amp
set @s = buildrowsetfromstring("Baby shark|Mommy shark|Daddy shark|Grandma shark|Grandpa shark|Let's go hunt|Run away|Safe at last|It's the end","|")
set @d=", doo doo doo doo doo doo"
set @n=char(10)
for @v=1 to 9 do
set @r = row(@s,@v)
set @f = field(@r,1)