ampscript-data 3.7.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/package.json +2 -2
- package/src/constants.js +63 -0
- package/src/derived.js +100 -0
- package/src/functions/content.js +1039 -0
- package/src/functions/data-extension.js +1118 -0
- package/src/functions/date-time.js +416 -0
- package/src/functions/einstein-email-recs.js +32 -0
- package/src/functions/encryption-encoding.js +550 -0
- package/src/functions/http.js +342 -0
- package/src/functions/index.js +203 -0
- package/src/functions/marketing-cloud-api.js +378 -0
- package/src/functions/math.js +167 -0
- package/src/functions/microsoft-dynamics.js +400 -0
- package/src/functions/mobileconnect.js +339 -0
- package/src/functions/sales-service-cloud.js +230 -0
- package/src/functions/social.js +151 -0
- package/src/functions/string.js +432 -0
- package/src/functions/utility.js +1120 -0
- package/src/globals.js +9 -0
- package/src/index.js +41 -7235
- package/src/keywords.js +121 -0
- package/src/operators.js +66 -0
- package/src/personalization.js +254 -0
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
// AUTO-SPLIT from the original single-file src/index.js. Data moved verbatim.
|
|
2
|
+
// AMPscript FUNCTIONS — category: Date and Time (10 entries).
|
|
3
|
+
|
|
4
|
+
import { BOOLEAN_LIKE_LITERAL_VALUES } from '../constants.js';
|
|
5
|
+
|
|
6
|
+
export const DATE_TIME_FUNCTIONS = [
|
|
7
|
+
{
|
|
8
|
+
name: 'DateAdd',
|
|
9
|
+
supportedInCloudPage: true,
|
|
10
|
+
supportedInEmail: true,
|
|
11
|
+
mcnSince: 67,
|
|
12
|
+
handlebarsEquivalent: 'dateAdd',
|
|
13
|
+
handlebarsExact: true,
|
|
14
|
+
mcnNotes: null,
|
|
15
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-date-add.html',
|
|
16
|
+
guideUrl: 'https://ampscript.guide/dateadd/',
|
|
17
|
+
sfmcGuideUrl: 'https://sfmc.guide/engagement/ampscript/functions/dateadd/',
|
|
18
|
+
isConfirmed: true,
|
|
19
|
+
differsFromOfficialDocs: false,
|
|
20
|
+
minArgs: 3,
|
|
21
|
+
maxArgs: 3,
|
|
22
|
+
category: 'Date and Time',
|
|
23
|
+
description:
|
|
24
|
+
'Adds a whole number of intervals to a date value. Only the five documented units are accepted and every other unit, including seconds and weeks, aborts the page — as does a non-integer amount or a date the engine cannot parse.',
|
|
25
|
+
params: [
|
|
26
|
+
{
|
|
27
|
+
name: 'date',
|
|
28
|
+
description:
|
|
29
|
+
'The date to adjust, either a real date value or a parseable date string',
|
|
30
|
+
type: 'string|date',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'amountToAdd',
|
|
34
|
+
description:
|
|
35
|
+
'Whole number of intervals to add; negative subtracts, zero returns the date unchanged, and a decimal aborts the page',
|
|
36
|
+
type: 'string|number',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'unitToAdd',
|
|
40
|
+
description:
|
|
41
|
+
'The unit to add, case-insensitive. Accepted values: Y (years), M (months), D (days), H (hours), MI (minutes). Any other value aborts the page',
|
|
42
|
+
type: 'string',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
returnType: 'date',
|
|
46
|
+
returnDescription:
|
|
47
|
+
'The resulting date value, which the other date functions accept directly. Adding months clamps to the last day of the shorter target month.',
|
|
48
|
+
syntax: 'DateAdd(date, amountToAdd, unitToAdd)',
|
|
49
|
+
example: "%%=DateAdd(Now(), 7, 'D')=%%",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'DateDiff',
|
|
53
|
+
supportedInCloudPage: true,
|
|
54
|
+
supportedInEmail: true,
|
|
55
|
+
mcnSince: 67,
|
|
56
|
+
handlebarsEquivalent: 'dateDiff',
|
|
57
|
+
handlebarsExact: true,
|
|
58
|
+
mcnNotes: null,
|
|
59
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-date-diff.html',
|
|
60
|
+
guideUrl: 'https://ampscript.guide/datediff/',
|
|
61
|
+
minArgs: 3,
|
|
62
|
+
maxArgs: 3,
|
|
63
|
+
category: 'Date and Time',
|
|
64
|
+
description:
|
|
65
|
+
'Counts how many boundaries of the requested unit lie between two dates, by truncating both to that unit and subtracting — so a 23-hour gap that crosses midnight counts as 1 day, while 23 hours within one day counts as 0. Finer units than the one requested are ignored rather than rounded.',
|
|
66
|
+
params: [
|
|
67
|
+
{
|
|
68
|
+
name: 'startDate',
|
|
69
|
+
description:
|
|
70
|
+
'The starting date, either a real date value or a parseable date string',
|
|
71
|
+
type: 'string|date',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'endDate',
|
|
75
|
+
description:
|
|
76
|
+
'The end date, either a real date value or a parseable date string; a later end date gives a positive result and an earlier one a negative result',
|
|
77
|
+
type: 'string|date',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'unitOfDifference',
|
|
81
|
+
description:
|
|
82
|
+
'The unit to count in, case-insensitive. Accepted values: Y (years), M (months), D (days), H (hours), MI (minutes). Any other value aborts the page',
|
|
83
|
+
type: 'string',
|
|
84
|
+
enum: ['Y', 'M', 'D', 'H', 'MI'],
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
returnType: 'number',
|
|
88
|
+
returnDescription:
|
|
89
|
+
'A whole number that is negative when the end date precedes the start date and 0 when both fall inside the same unit.',
|
|
90
|
+
syntax: 'DateDiff(startDate, endDate, unitOfDifference)',
|
|
91
|
+
example: "%%=DateDiff(Now(), DateAdd(Now(), 1, 'D'), 'MI')=%%",
|
|
92
|
+
isConfirmed: true,
|
|
93
|
+
differsFromOfficialDocs: false,
|
|
94
|
+
sfmcGuideUrl: 'https://sfmc.guide/engagement/ampscript/functions/datediff/',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'DateParse',
|
|
98
|
+
supportedInCloudPage: true,
|
|
99
|
+
supportedInEmail: true,
|
|
100
|
+
mcnSince: 67,
|
|
101
|
+
handlebarsEquivalent: null,
|
|
102
|
+
mcnNotes: null,
|
|
103
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-date-parse.html',
|
|
104
|
+
guideUrl: 'https://ampscript.guide/dateparse/',
|
|
105
|
+
minArgs: 1,
|
|
106
|
+
maxArgs: 2,
|
|
107
|
+
category: 'Date and Time',
|
|
108
|
+
description:
|
|
109
|
+
'Parses a date string into a date value. A string the parser cannot read aborts the page instead of returning a sentinel, and an ambiguous day-first string such as 5/8/2026 is silently read month-first rather than rejected. An offset or GMT marker in the input is honoured and converted to the account time zone.',
|
|
110
|
+
isConfirmed: true,
|
|
111
|
+
differsFromOfficialDocs: false,
|
|
112
|
+
sfmcGuideUrl: 'https://sfmc.guide/engagement/ampscript/functions/dateparse/',
|
|
113
|
+
params: [
|
|
114
|
+
{
|
|
115
|
+
name: 'dateString',
|
|
116
|
+
description:
|
|
117
|
+
'A date or timestamp string, or an existing date value; anything the parser cannot read aborts the page',
|
|
118
|
+
type: 'string|date',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'useUtc',
|
|
122
|
+
mcnSince: null,
|
|
123
|
+
mcnNotes: null,
|
|
124
|
+
description:
|
|
125
|
+
'If true, return the instant in UTC; otherwise in the account time zone. Accepts 1/0, true/false, or those spellings quoted, and is not validated',
|
|
126
|
+
type: 'string|boolean|number',
|
|
127
|
+
enum: BOOLEAN_LIKE_LITERAL_VALUES,
|
|
128
|
+
optional: true,
|
|
129
|
+
default: false,
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
returnType: 'date',
|
|
133
|
+
returnDescription:
|
|
134
|
+
'A real date value the other date functions accept directly. Rendered on its own it prints as a US short date followed by a 12-hour clock with an AM/PM suffix.',
|
|
135
|
+
syntax: 'DateParse(dateString[, useUtc])',
|
|
136
|
+
example: "%%=DateParse('2026-01-15T08:30:00', 1)=%%",
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: 'DatePart',
|
|
140
|
+
supportedInCloudPage: true,
|
|
141
|
+
supportedInEmail: true,
|
|
142
|
+
mcnSince: null,
|
|
143
|
+
handlebarsEquivalent: null,
|
|
144
|
+
mcnNotes: null,
|
|
145
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-date-part.html',
|
|
146
|
+
guideUrl: 'https://ampscript.guide/datepart/',
|
|
147
|
+
minArgs: 2,
|
|
148
|
+
maxArgs: 2,
|
|
149
|
+
category: 'Date and Time',
|
|
150
|
+
description:
|
|
151
|
+
'Extracts one component from a date. The hour is reported on a 12-hour clock with no AM/PM indicator, so 19:35 yields 7 and any time at midnight — including a date with no time part at all — yields 12. Month and day come back zero-padded to two digits while hour and minute do not.',
|
|
152
|
+
isConfirmed: true,
|
|
153
|
+
differsFromOfficialDocs: false,
|
|
154
|
+
sfmcGuideUrl: 'https://sfmc.guide/engagement/ampscript/functions/datepart/',
|
|
155
|
+
params: [
|
|
156
|
+
{
|
|
157
|
+
name: 'dateString',
|
|
158
|
+
description:
|
|
159
|
+
'A real date value or a parseable date string; an unreadable or empty value aborts the page',
|
|
160
|
+
type: 'string|date',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'datePart',
|
|
164
|
+
mcnSince: null,
|
|
165
|
+
mcnNotes: null,
|
|
166
|
+
description:
|
|
167
|
+
'The component to extract, case-insensitive. Any other value aborts the page',
|
|
168
|
+
type: 'string',
|
|
169
|
+
enum: [
|
|
170
|
+
'year',
|
|
171
|
+
'Y',
|
|
172
|
+
'month',
|
|
173
|
+
'M',
|
|
174
|
+
'monthName',
|
|
175
|
+
'day',
|
|
176
|
+
'D',
|
|
177
|
+
'hour',
|
|
178
|
+
'H',
|
|
179
|
+
'minute',
|
|
180
|
+
'MI',
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
returnType: 'string',
|
|
185
|
+
returnDescription:
|
|
186
|
+
'The requested component as text — a zero-padded two-digit month or day, an unpadded hour or minute, a four-digit year, or the full English month name. Numeric components still feed the math functions directly.',
|
|
187
|
+
syntax: 'DatePart(dateString, datePart)',
|
|
188
|
+
example: "%%=DatePart('2026-01-15', 'Y')=%%",
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: 'FormatDate',
|
|
192
|
+
supportedInCloudPage: true,
|
|
193
|
+
supportedInEmail: true,
|
|
194
|
+
mcnSince: 67,
|
|
195
|
+
handlebarsEquivalent: 'format',
|
|
196
|
+
handlebarsExact: false,
|
|
197
|
+
mcnNotes:
|
|
198
|
+
'In MCN, uses Java SimpleDateFormat format strings instead of .NET. Omitting dateFormat returns the G standard format (e.g. "5/15/2026 1:23:45 PM").',
|
|
199
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-format-date.html',
|
|
200
|
+
guideUrl: 'https://ampscript.guide/formatdate/',
|
|
201
|
+
minArgs: 1,
|
|
202
|
+
maxArgs: 4,
|
|
203
|
+
category: 'Date and Time',
|
|
204
|
+
isConfirmed: true,
|
|
205
|
+
differsFromOfficialDocs: true,
|
|
206
|
+
officialDocsNote:
|
|
207
|
+
'The official reference presents one .NET-style custom-pattern table and shows it applied to the dateFormat argument, but at runtime the two format arguments use SEPARATE, case-INSENSITIVE token sets. In dateFormat, mm and MM both render the MONTH, so the documented pattern yyyy-MM-dd HH:mm:ss returned 2026-03-04 13:03:07 for the instant 2026-03-04 13:52:07 — the minutes position printed 03, the month. The same pattern moved to timeFormat returned 13:52:07 correctly, because there mm and MM mean minutes. Single-letter tokens also disagree with the doc: d rendered the whole short date 3/4/2026 rather than the day number, M rendered March 4 rather than 3, and h or H alone in timeFormat aborts the page with HTTP 422 instead of rendering an hour. The day-name tokens are off by one repetition — dddd rendered Wed where the doc promises Wednesday, ddddd rendered Wednesday, and ddd rendered the corrupted string We4ne74a26 in which digits from the date replaced letters of the day name.',
|
|
208
|
+
sfmcGuideUrl: 'https://sfmc.guide/engagement/ampscript/functions/formatdate/',
|
|
209
|
+
description:
|
|
210
|
+
'Formats a date according to a date pattern, a time pattern and a locale. The two pattern arguments use separate, case-insensitive token sets: in the date pattern mm means month, and minutes are only reachable from the time pattern.',
|
|
211
|
+
params: [
|
|
212
|
+
{
|
|
213
|
+
name: 'dateString',
|
|
214
|
+
description:
|
|
215
|
+
'The date to format, either a real date value or a parseable date string',
|
|
216
|
+
type: 'string|date',
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: 'dateFormat',
|
|
220
|
+
mcnSince: 67,
|
|
221
|
+
mcnNotes: null,
|
|
222
|
+
description:
|
|
223
|
+
'The date pattern, or a single-letter standard format such as D, G or s. Case-insensitive, and mm here means month, not minutes',
|
|
224
|
+
type: 'string',
|
|
225
|
+
optional: true,
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: 'timeFormat',
|
|
229
|
+
description:
|
|
230
|
+
'The time pattern. Case-insensitive, and this is the only argument in which mm means minutes',
|
|
231
|
+
type: 'string',
|
|
232
|
+
optional: true,
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: 'localeCode',
|
|
236
|
+
description:
|
|
237
|
+
'The locale for month and day names and for the standard formats, written with either a hyphen or an underscore',
|
|
238
|
+
type: 'string',
|
|
239
|
+
optional: true,
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
returnType: 'string',
|
|
243
|
+
returnDescription:
|
|
244
|
+
'The formatted date, or an empty string when the first argument cannot be parsed as a date.',
|
|
245
|
+
syntax: 'FormatDate(dateString[, dateFormat, timeFormat, localeCode])',
|
|
246
|
+
example: '%%=FormatDate(Now(), "dddd, MMMM d yyyy", "HH:mm:ss")=%%',
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: 'GetSendTime',
|
|
250
|
+
supportedInCloudPage: true,
|
|
251
|
+
supportedInEmail: true,
|
|
252
|
+
mcnSince: null,
|
|
253
|
+
handlebarsEquivalent: null,
|
|
254
|
+
mcnNotes: null,
|
|
255
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-get-send-time.html',
|
|
256
|
+
guideUrl: 'https://ampscript.guide/getsendtime/',
|
|
257
|
+
minArgs: 0,
|
|
258
|
+
maxArgs: 1,
|
|
259
|
+
category: 'Date and Time',
|
|
260
|
+
description:
|
|
261
|
+
'Returns a send timestamp: by default the time the send completed for the individual subscriber, or with a true argument the job start or publish time. Outside a send context, such as on a CloudPage, it returns the current system time instead of a send time, in every argument spelling.',
|
|
262
|
+
params: [
|
|
263
|
+
{
|
|
264
|
+
name: 'boolAllSubscribers',
|
|
265
|
+
mcnSince: null,
|
|
266
|
+
mcnNotes: null,
|
|
267
|
+
description:
|
|
268
|
+
'If true, return the job start or publish time instead of the individual subscriber send-completed time; outside a send context it makes no difference. Accepts 1/0, true/false, or those spellings quoted, and is not validated',
|
|
269
|
+
type: 'string|boolean|number',
|
|
270
|
+
enum: BOOLEAN_LIKE_LITERAL_VALUES,
|
|
271
|
+
optional: true,
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
returnType: 'date',
|
|
275
|
+
returnDescription:
|
|
276
|
+
'A real date value the other date functions accept directly, in the same system time zone as Now().',
|
|
277
|
+
syntax: 'GetSendTime([boolAllSubscribers])',
|
|
278
|
+
example: '%%=GetSendTime(1)=%%',
|
|
279
|
+
isConfirmed: true,
|
|
280
|
+
differsFromOfficialDocs: false,
|
|
281
|
+
officialDocsNote:
|
|
282
|
+
'GetSendTime() has a working invocation (arity 0 and 1) that renders a real date value in every argument spelling, and its behaviour matches the official reference. Outside a send context, it returns the current system time: on a CloudPage it renders the same instant as Now() — both resolve to the same microsecond (FormatDate(..., "ffffff") is 507042 for each) rather than merely the same second. Every argument spelling (1, 0, true, false, "1", "0", "true", "false", and the non-flag word spring) returns that same current time, and DateDiff(GetSendTime(1), Now(), "MI") is 0. The value is a real date (FormatDate gives 2026-08-08, DatePart gives 2026 and 7, DateAdd of three hours advances it, DateDiff measures that gap as 3), it renders as a US short date plus a 12-hour clock (Length 19 for that instant), Empty() over it is False, and it is the system-side instant (DateDiff to SystemDateToLocalDate is 480 minutes, the same as over Now()); arity 2 aborts with HTTP 422. This matches the official reference\'s "during a send" row, which states both call forms return the current system time. Inside a send job it is the send-execution system time: a send-context UpsertDE writeback into a results DE records the same instant as Now() in that send (upsert operations run only at send-completion, so a send must target at least one deliverable subscriber for the body to run). The function is fully working; it is not a Sender-Authenticated-Redirection / session-state function, so no authenticated-context caveat applies.',
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
name: 'LocalDateToSystemDate',
|
|
286
|
+
supportedInCloudPage: true,
|
|
287
|
+
supportedInEmail: true,
|
|
288
|
+
mcnSince: null,
|
|
289
|
+
handlebarsEquivalent: 'timeZoneConversion',
|
|
290
|
+
handlebarsExact: false,
|
|
291
|
+
mcnNotes: null,
|
|
292
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-local-date-to-system-date.html',
|
|
293
|
+
guideUrl: 'https://ampscript.guide/localdatetosystemdate/',
|
|
294
|
+
minArgs: 1,
|
|
295
|
+
maxArgs: 1,
|
|
296
|
+
category: 'Date and Time',
|
|
297
|
+
description:
|
|
298
|
+
'Converts a date in the time zone configured on the account to the Marketing Cloud system date (Central Time, no daylight saving). The shift is not constant: the local side observes daylight saving, so a summer instant moves one hour further than a winter one. A value the date parser cannot read aborts the page instead of returning a sentinel.',
|
|
299
|
+
params: [
|
|
300
|
+
{
|
|
301
|
+
name: 'timeToConvert',
|
|
302
|
+
description:
|
|
303
|
+
'The local time value to convert, as a date value or a parseable date string',
|
|
304
|
+
type: 'string|date',
|
|
305
|
+
},
|
|
306
|
+
],
|
|
307
|
+
returnType: 'date',
|
|
308
|
+
returnDescription:
|
|
309
|
+
'A real date value the other date functions accept directly. Rendered on its own it prints as a US short date followed by a 12-hour clock with an AM/PM suffix.',
|
|
310
|
+
syntax: 'LocalDateToSystemDate(timeToConvert)',
|
|
311
|
+
example: '%%=LocalDateToSystemDate(Now())=%%',
|
|
312
|
+
isConfirmed: true,
|
|
313
|
+
differsFromOfficialDocs: false,
|
|
314
|
+
sfmcGuideUrl: 'https://sfmc.guide/engagement/ampscript/functions/localdatetosystemdate/',
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
name: 'Now',
|
|
318
|
+
supportedInCloudPage: true,
|
|
319
|
+
supportedInEmail: true,
|
|
320
|
+
mcnSince: 67,
|
|
321
|
+
handlebarsEquivalent: 'now',
|
|
322
|
+
handlebarsExact: false,
|
|
323
|
+
mcnNotes: null,
|
|
324
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-now.html',
|
|
325
|
+
guideUrl: 'https://ampscript.guide/now/',
|
|
326
|
+
sfmcGuideUrl: 'https://sfmc.guide/engagement/ampscript/functions/now/',
|
|
327
|
+
minArgs: 0,
|
|
328
|
+
maxArgs: 1,
|
|
329
|
+
category: 'Date and Time',
|
|
330
|
+
description:
|
|
331
|
+
'Returns the current system date and time in Central Standard Time, with no daylight-saving adjustment. Every call within one render returns the same instant.',
|
|
332
|
+
isConfirmed: true,
|
|
333
|
+
differsFromOfficialDocs: false,
|
|
334
|
+
params: [
|
|
335
|
+
{
|
|
336
|
+
name: 'persistFormat',
|
|
337
|
+
mcnSince: null,
|
|
338
|
+
mcnNotes: null,
|
|
339
|
+
description:
|
|
340
|
+
'In a send context, a true value returns the send job start or publish time instead of the current time; on a CloudPage it makes no difference. Accepts 1/0, true/false, or those spellings quoted',
|
|
341
|
+
type: 'string|boolean|number',
|
|
342
|
+
enum: BOOLEAN_LIKE_LITERAL_VALUES,
|
|
343
|
+
optional: true,
|
|
344
|
+
},
|
|
345
|
+
],
|
|
346
|
+
returnType: 'date',
|
|
347
|
+
returnDescription:
|
|
348
|
+
'The system date and time, as a date value that the other date functions accept directly.',
|
|
349
|
+
syntax: 'Now([persistFormat])',
|
|
350
|
+
example: '%%=Now()=%%',
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
name: 'StringToDate',
|
|
354
|
+
supportedInCloudPage: true,
|
|
355
|
+
supportedInEmail: true,
|
|
356
|
+
mcnSince: 67,
|
|
357
|
+
handlebarsEquivalent: null,
|
|
358
|
+
mcnNotes:
|
|
359
|
+
'In MCN, returns a locale-formatted string (G standard format, e.g. "5/15/2026 1:23:45 PM") instead of a dateTime object. Cannot be reliably passed to FormatDate() or other date functions in MCN - use FormatDate() directly instead.',
|
|
360
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-string-to-date.html',
|
|
361
|
+
guideUrl: 'https://ampscript.guide/stringtodate/',
|
|
362
|
+
sfmcGuideUrl: 'https://sfmc.guide/engagement/ampscript/functions/stringtodate/',
|
|
363
|
+
minArgs: 1,
|
|
364
|
+
maxArgs: 1,
|
|
365
|
+
category: 'Date and Time',
|
|
366
|
+
description:
|
|
367
|
+
'Converts a date string to a date value. Behaves identically to DateParse for every input format, but takes no second argument, so DateParse is the only one of the two that can return the instant in UTC. A string the parser cannot read aborts the page instead of returning a sentinel, and an ambiguous day-first string such as 5/8/2026 is silently read month-first rather than rejected.',
|
|
368
|
+
params: [
|
|
369
|
+
{
|
|
370
|
+
name: 'dateString',
|
|
371
|
+
description:
|
|
372
|
+
'A date or timestamp string, or an existing date value; anything the parser cannot read aborts the page',
|
|
373
|
+
type: 'string|date',
|
|
374
|
+
},
|
|
375
|
+
],
|
|
376
|
+
returnType: 'date',
|
|
377
|
+
returnDescription:
|
|
378
|
+
'A real date value the other date functions accept directly. Rendered on its own it prints as a US short date followed by a 12-hour clock with an AM/PM suffix.',
|
|
379
|
+
syntax: 'StringToDate(dateString)',
|
|
380
|
+
example: "%%=StringToDate('2026-01-15')=%%",
|
|
381
|
+
isConfirmed: true,
|
|
382
|
+
differsFromOfficialDocs: false,
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
name: 'SystemDateToLocalDate',
|
|
386
|
+
supportedInCloudPage: true,
|
|
387
|
+
supportedInEmail: true,
|
|
388
|
+
mcnSince: null,
|
|
389
|
+
handlebarsEquivalent: 'timeZoneConversion',
|
|
390
|
+
handlebarsExact: false,
|
|
391
|
+
mcnNotes: null,
|
|
392
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-system-date-to-local-date.html',
|
|
393
|
+
guideUrl: 'https://ampscript.guide/systemdatetolocaldate/',
|
|
394
|
+
minArgs: 1,
|
|
395
|
+
maxArgs: 1,
|
|
396
|
+
category: 'Date and Time',
|
|
397
|
+
description:
|
|
398
|
+
'Converts a Marketing Cloud system date (Central Time, no daylight saving) to the time zone configured on the account. The shift is not constant: the local side observes daylight saving, so a summer instant moves one hour further than a winter one. A value the date parser cannot read aborts the page instead of returning a sentinel.',
|
|
399
|
+
params: [
|
|
400
|
+
{
|
|
401
|
+
name: 'systemTime',
|
|
402
|
+
description:
|
|
403
|
+
'The system time value to convert, as a date value or a parseable date string',
|
|
404
|
+
type: 'string|date',
|
|
405
|
+
},
|
|
406
|
+
],
|
|
407
|
+
returnType: 'date',
|
|
408
|
+
returnDescription:
|
|
409
|
+
'A real date value the other date functions accept directly. Rendered on its own it prints as a US short date followed by a 12-hour clock with an AM/PM suffix.',
|
|
410
|
+
isConfirmed: true,
|
|
411
|
+
differsFromOfficialDocs: false,
|
|
412
|
+
sfmcGuideUrl: 'https://sfmc.guide/engagement/ampscript/functions/systemdatetolocaldate/',
|
|
413
|
+
syntax: 'SystemDateToLocalDate(systemTime)',
|
|
414
|
+
example: '%%=SystemDateToLocalDate(Now())=%%',
|
|
415
|
+
},
|
|
416
|
+
];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// AUTO-SPLIT from the original single-file src/index.js. Data moved verbatim.
|
|
2
|
+
// AMPscript FUNCTIONS — category: Einstein Email Recommendations (1 entries).
|
|
3
|
+
|
|
4
|
+
export const EINSTEIN_EMAIL_RECS_FUNCTIONS = [
|
|
5
|
+
{
|
|
6
|
+
name: 'RatingStars',
|
|
7
|
+
supportedInCloudPage: false,
|
|
8
|
+
supportedInEmail: false,
|
|
9
|
+
mcnSince: null,
|
|
10
|
+
handlebarsEquivalent: null,
|
|
11
|
+
mcnNotes: null,
|
|
12
|
+
guideUrl: 'https://ampscript.guide/ratingstars/',
|
|
13
|
+
minArgs: 3,
|
|
14
|
+
maxArgs: 3,
|
|
15
|
+
category: 'Einstein Email Recommendations',
|
|
16
|
+
description: 'Renders a star-rating image using Einstein recommendations data.',
|
|
17
|
+
params: [
|
|
18
|
+
{ name: 'rating', description: 'Current rating value', type: 'number' },
|
|
19
|
+
{ name: 'maxRating', description: 'Maximum rating value', type: 'number' },
|
|
20
|
+
{ name: 'imageUrl', description: 'Base URL for star images', type: 'string' },
|
|
21
|
+
],
|
|
22
|
+
returnType: 'string',
|
|
23
|
+
returnDescription: 'An HTML string of star images representing the rating.',
|
|
24
|
+
syntax: 'RatingStars(rating, maxRating, imageUrl)',
|
|
25
|
+
example: "%%=RatingStars(4, 5, 'https://example.com/star.png')=%%",
|
|
26
|
+
isConfirmed: false,
|
|
27
|
+
verificationBlocked: true,
|
|
28
|
+
verificationBlockedReason: 'no-test-data',
|
|
29
|
+
officialDocsNote:
|
|
30
|
+
'No working CloudPage invocation exists. Any valid-arity call aborts the whole page with HTTP 422 at compile time, even when placed inside an unreached IF branch, so it cannot be hidden behind a query-string switch. Two signature shapes both abort: the catalog form RatingStars(4, 5, "https://example.com/star.png") and the ampscript.guide form RatingStars(5, "yellow", 25). An otherwise identical page returns HTTP 200 once the RatingStars call is removed, confirming the abort is caused by the function itself rather than the surrounding page. RatingStars is an Einstein Email Recommendations helper that appears to resolve only inside the recommendations rendering context, which a bare CloudPage does not supply.',
|
|
31
|
+
},
|
|
32
|
+
];
|