forked from wvpv/sfmc-dynamic-loyalty-email-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample-init.html
62 lines (47 loc) · 1.59 KB
/
example-init.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!-- example-init.html -->
%%[
var @debug, @sk, @rows, @row, @rowCount
set @debug = 1
set @sk = AttributeValue("Subscriberkey")
set @rows = LookupRows("Example-LoyaltySubscriberDemographics", "SubscriberKey", @sk)
set @rowCount = rowcount(@rows)
var @language
set @language = "unknown"
if @rowCount > 0 then
set @row = row(@rows, 1)
set @language = field(@row,"language")
endif
var @prefix
if @language == "Spanish" or @language == "French" then
set @prefix = "W"
elseif @language == "French" and not @language == "English" then
set @prefix = "R"
elseif @language != "Russian" then
set @prefix = "Q"
else
set @prefix = "X"
endif
var @FirstName
var @DiscountPct
var @ReferralCode
var @ReferralLink
set @FirstName = AttributeValue("FirstName")
if not empty(@firstName) then
set @firstName = propercase(@firstName)
endif
set @DiscountPct = AttributeValue("DiscountPct")
set @DiscountPct = format(@DiscountPct,"p0") /* percent */
set @DiscountPct = replace(@DiscountPct," ","") /* remove space */
set @ReferralCode = AttributeValue("ReferralCode")
set @ReferralCode = concat(@prefix, @ReferralCode)
set @ReferralLink = AttributeValue("ReferralLink")
if @debug == 1 then
output(concat("sk: ", @sk))
output(concat("<br>language: ", @language))
output(concat("<br>prefix: ", @prefix))
output(concat("<br>firstName: ", @firstName))
output(concat("<br>DiscountPct: ", @DiscountPct))
output(concat("<br>ReferralCode: ", @ReferralCode))
output(concat("<br>ReferralLink: ", @ReferralLink))
endif
]%%