-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
176 lines (154 loc) · 8.37 KB
/
index.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!--
%%[
/* This email template can be used to easily display the records of in a tabular format */
/* This is useful for Automation that sends a daily "Log" Data Extension to a recipient list */
/* Lookup configuration */
SET @DEName = "" /* Configure Data Extension name here (not External Key). Example: JourneyLog */
SET @NumberOfRecords = 250 /* Number of records to display in the email. Set to 0 to display up to 2000 max */
SET @DateField = "" /* Date field to order by. Example: SFMC_DateCreatedCST */
SET @ConstantField = "" /* The source Data Extension requires a numeric field with a default value of 1. This allows retrieval of all records in the Data Extension. Example: ConstantForLog */
/* Other configuration */
SET @NumberOfDaysNoEmails = 1 /* Used for Alert. 1 is 2 or more days ago */
SET @Subject = CONCAT (@DEName," Log") /* Result: [Data Extension Name] Log */
SET @AlertTest = false /* Used for testing alert SubjectLine and message */
SET @TimeZoneModifier = 17 /* All dates in the Data Extension are recorded in CST. Change this value to display results in your time zone. Example: +17 = Sydney, Australia */
SET @Logo = "https://upload.wikimedia.org/wikipedia/en/b/b6/Salesforce_Marketing_Cloud_Logo.png" /* Set a URL of your company logo here.
/* Configuring Fields to be displayed */
SET @DEFieldDisplay1 = "" /* Header row value for the column */
SET @DELookupField1 = "" /* Data Extension Field Name for the column */
SET @DEFieldDisplay2 = "" /* Header row value for the column */
SET @DELookupField2 = "" /* Data Extension Field Name for the column */
SET @DEFieldDisplay3 = "" /* Header row value for the column */
SET @DELookupField3 = "" /* Data Extension Field Name for the column */
/* Lookup starts */
SET @Rows = LOOKUPORDEREDROWS(@DEName, @NumberOfRecords, CONCAT(@DateField," ","DESC"), @ConstantField, "1")
SET @Number = ROWCOUNT(@Rows)
/* Checking timestamp of latest record for Alert*/
SET @Row = ROW(@Rows, 1)
SET @DateFieldCST = FIELD(@Row,@DateField)
SET @DateFieldAdjusted = DATEADD(@DateFieldCST,@TimeZoneModifier,"H")
SET @LocalDate = DATEADD(Now(),@TimeZoneModifier,"H")
SET @DateDiffAlert = DATEDIFF(@DateFieldAdjusted,@LocalDate, "D")
SET @YEAR = DatePart(@SFMC_DateCreatedAUS,"Y")
SET @MONTH = DatePart(@SFMC_DateCreatedAUS,"M")
SET @DAY = DatePart(@SFMC_DateCreatedAUS,"D")
SET @LastLogDate = CONCAT(@DAY,"/",@MONTH,"/",@YEAR)
/* Alerts for if there haven't been any sends in over a day */
IF (@DateDiffAlert > @NumberOfDaysNoEmails AND @DateDiffAlert < 2) OR @AlertTest == true THEN
SET @AlertText = "NO EMAILS HAVE BEEN SENT SINCE YESTERDAY!"
SET @Subject = "Journey Alert: NO EMAILS HAVE BEEN SENT SINCE YESTERDAY!"
ELSEIF @DateDiffAlert > 2 THEN
SET @AlertText = CONCAT("NO EMAILS HAVE BEEN SENT SINCE ",@LastLogDate)
SET @Subject = CONCAT("Journey Alert: NO EMAILS HAVE BEEN SENT SINCE ",@LastLogDate)
ENDIF
/* Set CSS colour indicator to odd */
SET @indicator = "odd"
]%%
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><META http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
<body>
<div style="margin:0px">
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="white" height="100%" style="font-family: proxima-nova,sans-serif">
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr height="87">
<td align="center" valign="top" bgcolor="#FFFFFF" height="87">
<table width="850" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="420" align="center"><img src="%%=v(@Logo)=%%" alt="Logo" width="378" height="134" border="0"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#231f20" height="22" style="font-size:22px; line-height: 22px; height:22px; mso-line-height-rule: exactly"> </td>
</tr>
<tr>
<td bgcolor="#f26532" height="22" style="font-size:22px; line-height: 22px; height:22px; mso-line-height-rule: exactly"> </td>
</tr>
<tr>
<td align="center" bgcolor="white"><br>
<table width="850" border="0" cellspacing="2" cellpadding="0">
<tr>
<td></td>
</tr>
</table>
<br>
<table width="850" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="600" align="left">
<!-- %%[ IF ISNULL(@AlertText) == false THEN ]%% -->
<span style="font-weight:bold;color: red; font-size:25px">%%=v(@AlertText)=%%</span>
<!-- %%[ ENDIF ]%% -->
<h2>Last %%=v(@NumberOfRecords)=%% Records (DE: %%=v(@DEName)=%%)</h2>
<table border="0" cellspacing="2" cellpadding="1">
<tr>
<td><b>Days Ago</b></td>
<td><b>Date Field (Local)</b></td>
<td><b>%%=v(@DEFieldDisplay1)=%%</b></td>
<td><b>%%=v(@DEFieldDisplay2)=%%</b></td>
<td><b>%%=v(@DEFieldDisplay3)=%%</b></td>
</tr>
<tr height="3">
</tr>
<!--%%[
FOR @index = 1 TO @Number DO
SET @Row = ROW(@Rows, @index)
SET @DateFieldCST = FIELD(@Row,@DateField)
SET @DateFieldAdjustedValue = DATEADD(@DateFieldCST,@TimeZoneModifier,"H") */ Or use the below for timezone adjustment based on the user */
*/ SET @DateFieldAdjustedValue = SystemDateToLocalDate(@DateFieldCST) */
SET @DELookupField1Value = FIELD(@Row,@DELookupField1)
SET @DELookupField2Value = FIELD(@Row,@DELookupField2)
SET @DELookupField3Value = FIELD(@Row,@DELookupField3)
/* If the CSS indicator is set to odd use a white background color */
IF @indicator == "odd" THEN
SET @color = "#FFFFFF"
SET @indicator = "even"
/* If the CSS indicator is set to even use a gray background color */
ELSE
SET @color = "#EEEEEE"
SET @indicator = "odd"
ENDIF
SET @LocalDateTime = DATEADD(Now(),@TimeZoneModifier,"H")
SET @DateDiffResultValue = DATEDIFF(@DateFieldAdjustedValue,@LocalDateTime, "D")
IF @DateDiffResultValue == 0 THEN
SET @DateDiffResultValue = "Today"
ELSEIF @DateDiffResultValue == 1 THEN
SET @DateDiffResultValue = "Yesterday"
ENDIF
]%% -->
<tr>
<td style="background-color:%%=v(@color)=%%">%%=v(@DateDiffResultValue)=%%</td>
<td style="background-color:%%=v(@color)=%%">%%=v(@DateFieldAdjustedValue)=%%</td>
<td style="background-color:%%=v(@color)=%%">%%=v(@DELookupField1Value)=%%</td>
<td style="background-color:%%=v(@color)=%%">%%=v(@DELookupField2Value)=%%</td>
<td style="background-color:%%=v(@color)=%%">%%=v(@DELookupField3Value)=%%</td>
</tr>
<!-- %%[
NEXT @index
]%% -->
</table>
</td>
</tr>
</table>
<img src="http://image.exct.net/lib/feca15757762047a/m/1/spacer.gif" alt="graphic" width="1" height="25" border="0">
</td>
</tr>
<tr height="12">
<td bgcolor="black" height="12"></td>
</tr>
<tr height="2">
<td bgcolor="#858e88" height="2"><table cellpadding="2" cellspacing="0" width="600" border="0" align="center"><tr><td><font face="verdana" size="1" color="#444444">This email was sent by: <b>%%Member_Busname%%</b><br>%%Member_Addr%% %%Member_City%%, %%Member_State%%, %%Member_PostalCode%%, %%Member_Country%% | <a href="%%profile_center_url%%" alias="Update Profile" style="text-decoration:none;color:#444444">Update Profile</a></font></td></tr></table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
<custom name="opencounter" type="tracking" />