Skip to content

Instantly share code, notes, and snippets.

View wvpv's full-sized avatar

Adam Spriggs wvpv

View GitHub Profile
@wvpv
wvpv / TriggeredSendSummary.csv
Created December 28, 2021 15:40
SFMC TriggeredSendSummary SOAP Object schema
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
wvpv / sfmc_sql_subscribers_all_summary.sql
Created January 27, 2021 00:00
Summary of subscriber statuses by business unit
select
s.businessUnitMID
, s.businessUnitName
, s.status
, count(*) count
from subscribers_all s
group by
s.businessUnitMID
, s.businessUnitName
, s.status
@wvpv
wvpv / sfmc_sql_subscribers_all_unsubs.sql
Created January 26, 2021 23:57
SFMC unsubscribes per business unit
select
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
wvpv / sfmc_sql_subscribers_all.sql
Created January 26, 2021 23:53
SFMC all subscribers in all business units
select
s.SubscriberID
, s.SubscriberKey
, s.Status
, s.EmailAddress
, s.DateUnsubscribed
, s.DateJoined
, s.DateUndeliverable
, b.businessUnitMID
, b.businessUnitName
%%[
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)
outputline(concat(@f,@d,@n,@f,@d,@n,@f,@d,@n,@f,"!"))
%%[
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","|")
for @v=1 to 9 do
for @l=1 to 4 do
set @r = row(@s,@v)
set @f = field(@r,1)
%[
set @s = "Baby shark|Mommy shark|Daddy shark|Grandma shark|Grandpa shark|Let's go hunt|Run away|Safe at last|It's the end|"
for @i=1 to 112 do
set @c = substring(@s,@i,1)
if @c == "|" then
%%[
set @s = "Baby shark|Mommy shark|Daddy shark|Grandma shark|Grandpa shark|Let's go hunt|Run away|Safe at last|It's the end|"
for @v=1 to 9 do
set @f = substring(@s,1,add(indexOf(@s,"|"),-1))
set @s = replace(@s,concat(@f,"|"))
for @l=1 to 4 do
%%[
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","|")
for @v=1 to 36 do
set @l=substring(add(divide(add(@v,-1),4),1),1,1)
set @r = row(@s,@l)
set @f = field(@r,1)
%%[
set @l = 0
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","|")
for @v=1 to 36 do
set @m=mod(@v,4)
set @l=add(@l,iif(@m==1,1,0))