ssjs-data 0.3.2 → 0.3.4
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/dist/sfmc-globals.d.ts +3101 -37
- package/dist/site-index.json +3512 -0
- package/package.json +6 -2
- package/src/index.js +15 -2
- package/src/urls.js +203 -0
package/dist/sfmc-globals.d.ts
CHANGED
|
@@ -5,85 +5,912 @@
|
|
|
5
5
|
|
|
6
6
|
// ── Platform ────────────────────────────────────────────────────────────────
|
|
7
7
|
declare namespace Platform {
|
|
8
|
+
/**
|
|
9
|
+
* Loads a platform library. Must be called before using Core library objects.
|
|
10
|
+
*
|
|
11
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-load/)
|
|
12
|
+
*
|
|
13
|
+
* @param libraryName - Library to load (e.g. "core")
|
|
14
|
+
* @param version - Library version (e.g. "1.1.5")
|
|
15
|
+
* @example
|
|
16
|
+
* Platform.Load("core", "1.1.5");
|
|
17
|
+
* var de = DataExtension.Init("MyDE");
|
|
18
|
+
* var rows = de.Rows.Retrieve();
|
|
19
|
+
*/
|
|
8
20
|
function Load(libraryName: string, version: string): void;
|
|
9
21
|
namespace Function {
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves a single field value from a Data Extension row matching filter criteria. To filter by multiple columns, pass string arrays for whereFieldNames and whereFieldValues (AND logic).
|
|
24
|
+
*
|
|
25
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/lookup/)
|
|
26
|
+
*
|
|
27
|
+
* @param deName - Data Extension name or external key
|
|
28
|
+
* @param returnField - Name of the field to return
|
|
29
|
+
* @param whereFieldNames - Filter field name, or an array of field names connected with AND logic
|
|
30
|
+
* @param whereFieldValues - Filter field value matching whereFieldNames; must be an array of equal length when whereFieldNames is an array
|
|
31
|
+
* @example
|
|
32
|
+
* // Single filter:
|
|
33
|
+
* var email = Platform.Function.Lookup("Subscribers", "EmailAddress", "SubscriberKey", "abc123");
|
|
34
|
+
*
|
|
35
|
+
* // Multiple filters (AND logic):
|
|
36
|
+
* var phone = Platform.Function.Lookup("CustomerData", "Phone", ["FirstName", "LastName"], ["Carolyn", "Baumgartner"]);
|
|
37
|
+
*/
|
|
10
38
|
function Lookup(deName: string, returnField: string, whereFieldNames: string | string[], whereFieldValues: string | any[]): string;
|
|
39
|
+
/**
|
|
40
|
+
* Returns a result set of rows from a Data Extension matching filter criteria. Returns up to 2,000 rows. To filter by multiple columns, pass string arrays for whereFieldNames and whereFieldValues (AND logic).
|
|
41
|
+
*
|
|
42
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/lookuprows/)
|
|
43
|
+
*
|
|
44
|
+
* @param deName - Data Extension name or external key
|
|
45
|
+
* @param whereFieldNames - Filter field name, or an array of field names connected with AND logic
|
|
46
|
+
* @param whereFieldValues - Filter field value matching whereFieldNames; must be an array of equal length when whereFieldNames is an array
|
|
47
|
+
* @example
|
|
48
|
+
* // Single filter:
|
|
49
|
+
* var rows = Platform.Function.LookupRows("MyDE", "Status", "active");
|
|
50
|
+
* for (var i = 0; i < rows.length; i++) {
|
|
51
|
+
* Write(rows[i]["Name"] + "<br>");
|
|
52
|
+
* }
|
|
53
|
+
*
|
|
54
|
+
* // Multiple filters (AND logic):
|
|
55
|
+
* var rows2 = Platform.Function.LookupRows("CustomerData", ["PreferredLanguage", "RewardsTier"], ["English", "Gold"]);
|
|
56
|
+
*/
|
|
11
57
|
function LookupRows(deName: string, whereFieldNames: string | string[], whereFieldValues: string | any[]): object;
|
|
58
|
+
/**
|
|
59
|
+
* Returns an ordered result set from a Data Extension. The sort expression is a single string in the format "ColumnName ASC" or "ColumnName DESC". Multiple columns can be separated by commas. Returns up to 2,000 rows; values below 1 for count default to 2,000. To filter by multiple columns, pass string arrays for whereFieldNames and whereFieldValues (AND logic).
|
|
60
|
+
*
|
|
61
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/lookuporderedrows/)
|
|
62
|
+
*
|
|
63
|
+
* @param deName - Data Extension name or external key
|
|
64
|
+
* @param count - Maximum number of rows to return; values below 1 return up to 2,000
|
|
65
|
+
* @param orderBy - Sort expression using "ColumnName ASC/DESC" syntax (e.g. "LastName ASC, FirstName ASC")
|
|
66
|
+
* @param whereFieldNames - Filter field name, or an array of field names connected with AND logic
|
|
67
|
+
* @param whereFieldValues - Filter field value matching whereFieldNames; must be an array of equal length when whereFieldNames is an array
|
|
68
|
+
* @example
|
|
69
|
+
* // Single filter, sorted by LastName ASC:
|
|
70
|
+
* var rows = Platform.Function.LookupOrderedRows("MyDE", 10, "LastName ASC", "RewardsTier", "Silver");
|
|
71
|
+
* for (var i = 0; i < rows.length; i++) {
|
|
72
|
+
* Write(rows[i]["Email"] + "<br>");
|
|
73
|
+
* }
|
|
74
|
+
*
|
|
75
|
+
* // Multiple filters (AND logic):
|
|
76
|
+
* var rows2 = Platform.Function.LookupOrderedRows("CustomerData", 0, "LastName ASC", ["PreferredLanguage", "RewardsTier"], ["English", "Silver"]);
|
|
77
|
+
*/
|
|
12
78
|
function LookupOrderedRows(deName: string, count: number, orderBy: string, whereFieldNames: string | string[], whereFieldValues: string | any[]): object;
|
|
79
|
+
/**
|
|
80
|
+
* Adds a new row to a Data Extension. Use this function in CloudPages, landing pages, microsites, and SMS messages. Use InsertDE() for email contexts.
|
|
81
|
+
*
|
|
82
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/insertdata/)
|
|
83
|
+
*
|
|
84
|
+
* @param deName - Data Extension name or external key
|
|
85
|
+
* @param fieldNames - Array of column names to populate
|
|
86
|
+
* @param fieldValues - Array of values aligned to fieldNames
|
|
87
|
+
* @example
|
|
88
|
+
* var rowsAffected = Platform.Function.InsertData("MyDE", ["Email", "Name"], ["jane@example.com", "Jane"]);
|
|
89
|
+
*/
|
|
13
90
|
function InsertData(deName: string, fieldNames: string[], fieldValues: any[]): number;
|
|
91
|
+
/**
|
|
92
|
+
* Adds a new row to a Data Extension. Use this function in email contexts. Use InsertData() for CloudPages, landing pages, microsites, and SMS messages.
|
|
93
|
+
*
|
|
94
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/insertde/)
|
|
95
|
+
*
|
|
96
|
+
* @param deName - Data Extension name or external key
|
|
97
|
+
* @param fieldNames - Array of column names to populate
|
|
98
|
+
* @param fieldValues - Array of values aligned to fieldNames
|
|
99
|
+
* @example
|
|
100
|
+
* Platform.Function.InsertDE("MyDE", ["Email", "Name"], ["jane@example.com", "Jane"]);
|
|
101
|
+
*/
|
|
14
102
|
function InsertDE(deName: string, fieldNames: string[], fieldValues: any[]): void;
|
|
103
|
+
/**
|
|
104
|
+
* Modifies existing rows in a Data Extension matching filter criteria. Use this function in CloudPages, landing pages, microsites, and SMS messages. Use UpdateDE() for email contexts.
|
|
105
|
+
*
|
|
106
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/updatedata/)
|
|
107
|
+
*
|
|
108
|
+
* @param deName - Data Extension name or external key
|
|
109
|
+
* @param whereFieldNames - Column name(s) to identify the rows to update; use an array for multiple columns (AND logic)
|
|
110
|
+
* @param whereFieldValues - Value(s) to match in whereFieldNames; must be an array of equal length when whereFieldNames is an array
|
|
111
|
+
* @param fieldNames - Array of column names to update
|
|
112
|
+
* @param fieldValues - Array of new values aligned to fieldNames
|
|
113
|
+
* @example
|
|
114
|
+
* var count = Platform.Function.UpdateData("MyDE", ["Email"], ["jane@example.com"], ["Status"], ["inactive"]);
|
|
115
|
+
*/
|
|
15
116
|
function UpdateData(deName: string, whereFieldNames: string | string[], whereFieldValues: string | any[], fieldNames: string[], fieldValues: any[]): number;
|
|
117
|
+
/**
|
|
118
|
+
* Modifies existing rows in a Data Extension matching filter criteria. Use this function in email contexts. Use UpdateData() for CloudPages, landing pages, microsites, and SMS messages.
|
|
119
|
+
*
|
|
120
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/updatede/)
|
|
121
|
+
*
|
|
122
|
+
* @param deName - Data Extension name or external key
|
|
123
|
+
* @param whereFieldNames - Column name(s) to identify the rows to update; use an array for multiple columns (AND logic)
|
|
124
|
+
* @param whereFieldValues - Value(s) to match in whereFieldNames; must be an array of equal length when whereFieldNames is an array
|
|
125
|
+
* @param fieldNames - Array of column names to update
|
|
126
|
+
* @param fieldValues - Array of new values aligned to fieldNames
|
|
127
|
+
* @example
|
|
128
|
+
* var count = Platform.Function.UpdateDE("MyDE", ["Email"], ["jane@example.com"], ["Status"], ["inactive"]);
|
|
129
|
+
*/
|
|
16
130
|
function UpdateDE(deName: string, whereFieldNames: string | string[], whereFieldValues: string | any[], fieldNames: string[], fieldValues: any[]): number;
|
|
131
|
+
/**
|
|
132
|
+
* Inserts a new row or updates an existing one in a Data Extension. Use this function in non-sendable contexts such as CloudPages and landing pages.
|
|
133
|
+
*
|
|
134
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/upsertdata/)
|
|
135
|
+
*
|
|
136
|
+
* @param deName - Data Extension name or external key
|
|
137
|
+
* @param whereFieldNames - Column name(s) to identify an existing row; use an array for multiple columns (AND logic)
|
|
138
|
+
* @param whereFieldValues - Value(s) to match in whereFieldNames; must be an array of equal length when whereFieldNames is an array
|
|
139
|
+
* @param fieldNames - Array of column names to insert or update
|
|
140
|
+
* @param fieldValues - Array of values aligned to fieldNames
|
|
141
|
+
* @example
|
|
142
|
+
* var count = Platform.Function.UpsertData("CustomerData", ["ID"], ["12345"], ["Company", "Country"], ["exampleCompany", "USA"]);
|
|
143
|
+
*/
|
|
17
144
|
function UpsertData(deName: string, whereFieldNames: string | string[], whereFieldValues: string | any[], fieldNames: string[], fieldValues: any[]): number;
|
|
145
|
+
/**
|
|
146
|
+
* Inserts a new row or updates an existing one in a Data Extension. Use this function in sendable contexts such as email messages.
|
|
147
|
+
*
|
|
148
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/upsertde/)
|
|
149
|
+
*
|
|
150
|
+
* @param deName - Data Extension name or external key
|
|
151
|
+
* @param whereFieldNames - Column name(s) to identify an existing row; use an array for multiple columns (AND logic)
|
|
152
|
+
* @param whereFieldValues - Value(s) to match in whereFieldNames; must be an array of equal length when whereFieldNames is an array
|
|
153
|
+
* @param fieldNames - Array of column names to insert or update
|
|
154
|
+
* @param fieldValues - Array of values aligned to fieldNames
|
|
155
|
+
* @example
|
|
156
|
+
* var count = Platform.Function.UpsertDE("CustomerData", ["ID"], ["12345"], ["Company", "Country"], ["exampleCompany", "USA"]);
|
|
157
|
+
*/
|
|
18
158
|
function UpsertDE(deName: string, whereFieldNames: string | string[], whereFieldValues: string | any[], fieldNames: string[], fieldValues: any[]): number;
|
|
159
|
+
/**
|
|
160
|
+
* Removes rows from a Data Extension matching filter criteria. Use this function in non-sendable contexts such as CloudPages and landing pages. Use DeleteDE() for email contexts.
|
|
161
|
+
*
|
|
162
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/deletedata/)
|
|
163
|
+
*
|
|
164
|
+
* @param deName - Data Extension name or external key
|
|
165
|
+
* @param whereFieldNames - Array of column names to match for deletion
|
|
166
|
+
* @param whereFieldValues - Array of values aligned to whereFieldNames that identify rows to delete
|
|
167
|
+
* @example
|
|
168
|
+
* var count = Platform.Function.DeleteData("MyDE", ["Email"], ["jane@example.com"]);
|
|
169
|
+
*/
|
|
19
170
|
function DeleteData(deName: string, whereFieldNames: string[], whereFieldValues: any[]): number;
|
|
171
|
+
/**
|
|
172
|
+
* Removes rows from a Data Extension matching filter criteria. Use this function in email contexts. Use DeleteData() for CloudPages, landing pages, microsites, and SMS messages.
|
|
173
|
+
*
|
|
174
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/deletede/)
|
|
175
|
+
*
|
|
176
|
+
* @param deName - Data Extension name or external key
|
|
177
|
+
* @param whereFieldNames - Array of column names to match for deletion
|
|
178
|
+
* @param whereFieldValues - Array of values aligned to whereFieldNames that identify rows to delete
|
|
179
|
+
* @example
|
|
180
|
+
* var count = Platform.Function.DeleteDE("MyDE", ["Email"], ["jane@example.com"]);
|
|
181
|
+
*/
|
|
20
182
|
function DeleteDE(deName: string, whereFieldNames: string[], whereFieldValues: any[]): number;
|
|
183
|
+
/**
|
|
184
|
+
* Renders a Content Builder asset referenced by customer key.
|
|
185
|
+
*
|
|
186
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentblockbykey/)
|
|
187
|
+
*
|
|
188
|
+
* @param customerKey - Customer key of the Content Builder asset
|
|
189
|
+
* @param regionName - Impression region name for tracking
|
|
190
|
+
* @param stopOnError - When true, returns an exception and terminates if content cannot be retrieved. When false, the call proceeds.
|
|
191
|
+
* @param fallbackContent - Default content to display if the call does not return content
|
|
192
|
+
* @example
|
|
193
|
+
* var html = Platform.Function.ContentBlockByKey("my-header-block");
|
|
194
|
+
* Write(html);
|
|
195
|
+
*
|
|
196
|
+
* // With optional params:
|
|
197
|
+
* var html2 = Platform.Function.ContentBlockByKey("my-header-block", "impressionRegion", false, "defaultContent");
|
|
198
|
+
*/
|
|
21
199
|
function ContentBlockByKey(customerKey: string, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
|
|
200
|
+
/**
|
|
201
|
+
* Renders a Content Builder asset referenced by folder path and name. If the same name is used across multiple folders, supply the full path.
|
|
202
|
+
*
|
|
203
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentblockbyname/)
|
|
204
|
+
*
|
|
205
|
+
* @param name - Folder path and name of the Content Builder asset
|
|
206
|
+
* @param regionName - Impression region name for tracking
|
|
207
|
+
* @param stopOnError - When true, returns an error if the content area cannot be found or is invalid. When false, no error is returned.
|
|
208
|
+
* @param fallbackContent - Default content to return if an error occurs. Defaults to empty string.
|
|
209
|
+
* @param statusVariable - Receives the status of the call: 0 = success, -1 = no content or invalid content area
|
|
210
|
+
* @example
|
|
211
|
+
* var html = Platform.Function.ContentBlockByName("Shared Content/Footer");
|
|
212
|
+
* Write(html);
|
|
213
|
+
*/
|
|
22
214
|
function ContentBlockByName(name: string, regionName?: string, stopOnError?: boolean, fallbackContent?: string, statusVariable?: number): string;
|
|
215
|
+
/**
|
|
216
|
+
* Renders a Content Builder asset by its numeric identifier.
|
|
217
|
+
*
|
|
218
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentblockbyid/)
|
|
219
|
+
*
|
|
220
|
+
* @param id - Numeric ID of the Content Builder asset
|
|
221
|
+
* @param regionName - Impression region name for tracking
|
|
222
|
+
* @param stopOnError - When true, returns an exception and terminates if content cannot be retrieved. When false, the call proceeds.
|
|
223
|
+
* @param fallbackContent - Default content to display if the call does not return content
|
|
224
|
+
* @example
|
|
225
|
+
* var html = Platform.Function.ContentBlockByID(12345);
|
|
226
|
+
* Write(html);
|
|
227
|
+
*
|
|
228
|
+
* // With optional params:
|
|
229
|
+
* var html2 = Platform.Function.ContentBlockByID(12345, "impressionRegion", false, "defaultContent");
|
|
230
|
+
*/
|
|
23
231
|
function ContentBlockByID(id: number, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
|
|
232
|
+
/**
|
|
233
|
+
* Returns an HTML img tag for a Content Builder image identified by its external key. An optional fallback image ID can be supplied if the primary image is not found.
|
|
234
|
+
*
|
|
235
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentimagebykey/)
|
|
236
|
+
*
|
|
237
|
+
* @param key - External key of the Content Builder image
|
|
238
|
+
* @param fallbackId - Numeric ID of a fallback image when the primary cannot be found
|
|
239
|
+
* @example
|
|
240
|
+
* var imgTag = Platform.Function.ContentImageByKey("hero-banner-key");
|
|
241
|
+
* Write(imgTag);
|
|
242
|
+
*/
|
|
24
243
|
function ContentImageByKey(key: string, fallbackId?: number): string;
|
|
244
|
+
/**
|
|
245
|
+
* Returns an HTML img tag for a Content Builder image identified by its numeric ID. An optional fallback ID can be supplied if the primary image is not found.
|
|
246
|
+
*
|
|
247
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentimagebyid/)
|
|
248
|
+
*
|
|
249
|
+
* @param id - Numeric ID of the Content Builder image
|
|
250
|
+
* @param fallbackId - Numeric ID of a fallback image when the primary cannot be found
|
|
251
|
+
* @example
|
|
252
|
+
* var imgTag = Platform.Function.ContentImageByID(98765);
|
|
253
|
+
* Write(imgTag);
|
|
254
|
+
*/
|
|
25
255
|
function ContentImageByID(id: number, fallbackId?: number): string;
|
|
256
|
+
/**
|
|
257
|
+
* Processes a string as AMPscript/HTML and returns rendered output.
|
|
258
|
+
*
|
|
259
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/treatascontent/)
|
|
260
|
+
*
|
|
261
|
+
* @param content - String containing AMPscript or HTML to evaluate
|
|
262
|
+
* @example
|
|
263
|
+
* var result = Platform.Function.TreatAsContent("%%[Set @x = 1]%%%%=v(@x)=%%");
|
|
264
|
+
* Write(result); // "1"
|
|
265
|
+
*/
|
|
26
266
|
function TreatAsContent(content: string): string;
|
|
267
|
+
/**
|
|
268
|
+
* Marks the start of a named impression tracking region within content.
|
|
269
|
+
*
|
|
270
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/beginimpressionregion/)
|
|
271
|
+
*
|
|
272
|
+
* @param name - Name identifying the impression region
|
|
273
|
+
* @example
|
|
274
|
+
* Platform.Function.BeginImpressionRegion("hero-banner");
|
|
275
|
+
* Write(heroContent);
|
|
276
|
+
* Platform.Function.EndImpressionRegion();
|
|
277
|
+
*/
|
|
27
278
|
function BeginImpressionRegion(name: string): void;
|
|
279
|
+
/**
|
|
280
|
+
* Marks the end of an impression tracking region within content.
|
|
281
|
+
*
|
|
282
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/endimpressionregion/)
|
|
283
|
+
*
|
|
284
|
+
* @param closeAll - When true, closes all nested impression regions
|
|
285
|
+
* @example
|
|
286
|
+
* Platform.Function.BeginImpressionRegion("footer");
|
|
287
|
+
* Write(footerContent);
|
|
288
|
+
* Platform.Function.EndImpressionRegion();
|
|
289
|
+
*/
|
|
28
290
|
function EndImpressionRegion(closeAll?: boolean): void;
|
|
291
|
+
/**
|
|
292
|
+
* Returns the current system timestamp, or the timestamp of the triggering send when called with true.
|
|
293
|
+
*
|
|
294
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/now/)
|
|
295
|
+
*
|
|
296
|
+
* @param useContextTime - When true, returns the time the triggering send or activity was initiated. When false or omitted, returns the current system clock time.
|
|
297
|
+
* @example
|
|
298
|
+
* var current = Platform.Function.Now();
|
|
299
|
+
* Write(current); // e.g. "8/5/2025 12:00:00 PM"
|
|
300
|
+
*
|
|
301
|
+
* // Use context time during triggered sends:
|
|
302
|
+
* var sendTime = Platform.Function.Now(true);
|
|
303
|
+
*/
|
|
29
304
|
function Now(useContextTime?: boolean): string;
|
|
305
|
+
/**
|
|
306
|
+
* Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.
|
|
307
|
+
*
|
|
308
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/systemdatetolocaldate/)
|
|
309
|
+
*
|
|
310
|
+
* @param dateValue - Date-time string in system time (CST)
|
|
311
|
+
* @example
|
|
312
|
+
* var systemDate = Platform.Function.Now();
|
|
313
|
+
* var localDate = Platform.Function.SystemDateToLocalDate(systemDate);
|
|
314
|
+
* Write(localDate);
|
|
315
|
+
*/
|
|
30
316
|
function SystemDateToLocalDate(dateValue: string): string;
|
|
317
|
+
/**
|
|
318
|
+
* Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).
|
|
319
|
+
*
|
|
320
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/localdatetosystemdate/)
|
|
321
|
+
*
|
|
322
|
+
* @param dateValue - Date-time string in local account/user time
|
|
323
|
+
* @example
|
|
324
|
+
* var localDate = "8/5/2025 12:00:00 PM";
|
|
325
|
+
* var systemDate = Platform.Function.LocalDateToSystemDate(localDate);
|
|
326
|
+
* Write(systemDate);
|
|
327
|
+
*/
|
|
31
328
|
function LocalDateToSystemDate(dateValue: string): string;
|
|
329
|
+
/**
|
|
330
|
+
* Raises an error with an optional scope flag. When the second parameter is true, the error stops only the current recipient's send. When false, the error halts the entire send job.
|
|
331
|
+
*
|
|
332
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/raiseerror/)
|
|
333
|
+
*
|
|
334
|
+
* @param message - Error message describing what went wrong
|
|
335
|
+
* @param currentRecipientOnly - When true, the error applies only to the current recipient. When false, the entire send job stops.
|
|
336
|
+
* @param errorCode - Short user-defined code identifying the error type
|
|
337
|
+
* @param errorNumber - User-defined numeric error code for reference
|
|
338
|
+
* @example
|
|
339
|
+
* var status = Platform.Function.Lookup("MyDE", "Status", "Email", emailAddress);
|
|
340
|
+
* if (!status) {
|
|
341
|
+
* Platform.Function.RaiseError("Subscriber not found", true, "NOT_FOUND", 404);
|
|
342
|
+
* }
|
|
343
|
+
*/
|
|
32
344
|
function RaiseError(message: string, currentRecipientOnly?: boolean, errorCode?: string, errorNumber?: number): void;
|
|
345
|
+
/**
|
|
346
|
+
* Generates a new globally unique identifier string.
|
|
347
|
+
*
|
|
348
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/guid/)
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* var id = Platform.Function.GUID();
|
|
352
|
+
* Write(id); // e.g. "550e8400-e29b-41d4-a716-446655440000"
|
|
353
|
+
*/
|
|
33
354
|
function GUID(): string;
|
|
355
|
+
/**
|
|
356
|
+
* Checks whether a string is a valid email address format.
|
|
357
|
+
*
|
|
358
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/isemailaddress/)
|
|
359
|
+
*
|
|
360
|
+
* @param value - String to validate
|
|
361
|
+
* @example
|
|
362
|
+
* if (Platform.Function.IsEmailAddress(emailInput)) {
|
|
363
|
+
* Write("Valid email");
|
|
364
|
+
* } else {
|
|
365
|
+
* Write("Invalid email format");
|
|
366
|
+
* }
|
|
367
|
+
*/
|
|
34
368
|
function IsEmailAddress(value: string): boolean;
|
|
369
|
+
/**
|
|
370
|
+
* Evaluates whether a string contains a valid phone number.
|
|
371
|
+
*
|
|
372
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/isphonenumber/)
|
|
373
|
+
*
|
|
374
|
+
* @param value - String to evaluate
|
|
375
|
+
* @example
|
|
376
|
+
* if (Platform.Function.IsPhoneNumber(phoneInput)) {
|
|
377
|
+
* Write("Valid phone");
|
|
378
|
+
* } else {
|
|
379
|
+
* Write("Invalid phone number");
|
|
380
|
+
* }
|
|
381
|
+
*/
|
|
35
382
|
function IsPhoneNumber(value: string): boolean;
|
|
383
|
+
/**
|
|
384
|
+
* Instantiates a Marketing Cloud SOAP API object.
|
|
385
|
+
*
|
|
386
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/createobject/)
|
|
387
|
+
*
|
|
388
|
+
* @param objectType - SOAP API object type name
|
|
389
|
+
* @example
|
|
390
|
+
* var sub = Platform.Function.CreateObject("Subscriber");
|
|
391
|
+
* Platform.Function.SetObjectProperty(sub, "EmailAddress", "jane@example.com");
|
|
392
|
+
* Platform.Function.SetObjectProperty(sub, "SubscriberKey", "sk-123");
|
|
393
|
+
*/
|
|
36
394
|
function CreateObject(objectType: string): object;
|
|
395
|
+
/**
|
|
396
|
+
* Assigns a property value on a SOAP API object.
|
|
397
|
+
*
|
|
398
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/setobjectproperty/)
|
|
399
|
+
*
|
|
400
|
+
* @param apiObject - SOAP API object instance
|
|
401
|
+
* @param propertyName - Property name to set
|
|
402
|
+
* @param value - Value to assign
|
|
403
|
+
* @example
|
|
404
|
+
* var sub = Platform.Function.CreateObject("Subscriber");
|
|
405
|
+
* Platform.Function.SetObjectProperty(sub, "EmailAddress", "jane@example.com");
|
|
406
|
+
*/
|
|
37
407
|
function SetObjectProperty(apiObject: object, propertyName: string, value: any): void;
|
|
408
|
+
/**
|
|
409
|
+
* Appends an item to a SOAP API object's array property.
|
|
410
|
+
*
|
|
411
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/addobjectarrayitem/)
|
|
412
|
+
*
|
|
413
|
+
* @param apiObject - SOAP API object instance
|
|
414
|
+
* @param propertyName - Array property name
|
|
415
|
+
* @param value - Item to append
|
|
416
|
+
* @example
|
|
417
|
+
* var ts = Platform.Function.CreateObject("TriggeredSend");
|
|
418
|
+
* Platform.Function.AddObjectArrayItem(ts, "Subscribers", sub);
|
|
419
|
+
*/
|
|
38
420
|
function AddObjectArrayItem(apiObject: object, propertyName: string, value: any): void;
|
|
421
|
+
/**
|
|
422
|
+
* Executes a SOAP API Create call on an API object.
|
|
423
|
+
*
|
|
424
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokecreate/)
|
|
425
|
+
*
|
|
426
|
+
* @param apiObject - SOAP API object instance
|
|
427
|
+
* @param status - Array that receives the status and request ID of the API call (e.g. [0, 0])
|
|
428
|
+
* @param options - API configure options to include in the call. Can contain a null value.
|
|
429
|
+
* @example
|
|
430
|
+
* var StatusAndRequestID = [0, 0];
|
|
431
|
+
* var result = Platform.Function.InvokeCreate(CreateRequest, StatusAndRequestID, null);
|
|
432
|
+
* var status = StatusAndRequestID[0];
|
|
433
|
+
* var requestID = StatusAndRequestID[1];
|
|
434
|
+
*/
|
|
39
435
|
function InvokeCreate(apiObject: object, status: any[], options: object): object;
|
|
436
|
+
/**
|
|
437
|
+
* Executes a SOAP API Update call on an API object.
|
|
438
|
+
*
|
|
439
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokeupdate/)
|
|
440
|
+
*
|
|
441
|
+
* @param apiObject - SOAP API object instance
|
|
442
|
+
* @param status - Array that receives the status and request ID of the API call (e.g. [0, 0])
|
|
443
|
+
* @param options - API configure options to include in the call. Can contain a null value.
|
|
444
|
+
* @example
|
|
445
|
+
* var StatusAndRequestID = [0, 0];
|
|
446
|
+
* var result = Platform.Function.InvokeUpdate(UpdateRequest, StatusAndRequestID, null);
|
|
447
|
+
* var status = StatusAndRequestID[0];
|
|
448
|
+
* var requestID = StatusAndRequestID[1];
|
|
449
|
+
*/
|
|
40
450
|
function InvokeUpdate(apiObject: object, status: any[], options: object): object;
|
|
451
|
+
/**
|
|
452
|
+
* Executes a SOAP API Delete call on an API object.
|
|
453
|
+
*
|
|
454
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokedelete/)
|
|
455
|
+
*
|
|
456
|
+
* @param apiObject - SOAP API object instance
|
|
457
|
+
* @param status - Array that receives the status and request ID of the API call (e.g. [0, 0])
|
|
458
|
+
* @param options - API configure options to include in the call. Can contain a null value.
|
|
459
|
+
* @example
|
|
460
|
+
* var StatusAndRequestID = [0, 0];
|
|
461
|
+
* var result = Platform.Function.InvokeDelete(DeleteRequest, StatusAndRequestID, null);
|
|
462
|
+
* var status = StatusAndRequestID[0];
|
|
463
|
+
* var requestID = StatusAndRequestID[1];
|
|
464
|
+
*/
|
|
41
465
|
function InvokeDelete(apiObject: object, status: any[], options: object): object;
|
|
466
|
+
/**
|
|
467
|
+
* Executes a SOAP API Retrieve call.
|
|
468
|
+
*
|
|
469
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokeretrieve/)
|
|
470
|
+
*
|
|
471
|
+
* @param apiObject - SOAP API RetrieveRequest object instance
|
|
472
|
+
* @param status - Array that receives the status and request ID of the API call (e.g. [0, 0])
|
|
473
|
+
* @example
|
|
474
|
+
* var RetrieveRequest = Platform.Function.CreateObject("RetrieveRequest");
|
|
475
|
+
* Platform.Function.SetObjectProperty(RetrieveRequest, "ObjectType", "Email");
|
|
476
|
+
* Platform.Function.AddObjectArrayItem(RetrieveRequest, "Properties", "Email.Name");
|
|
477
|
+
* var StatusAndRequestID = [0, 0];
|
|
478
|
+
* var Emails = Platform.Function.InvokeRetrieve(RetrieveRequest, StatusAndRequestID);
|
|
479
|
+
*/
|
|
42
480
|
function InvokeRetrieve(apiObject: object, status: any[]): object;
|
|
481
|
+
/**
|
|
482
|
+
* Executes a SOAP API Perform action on an API object.
|
|
483
|
+
*
|
|
484
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokeperform/)
|
|
485
|
+
*
|
|
486
|
+
* @param apiObject - SOAP API object instance
|
|
487
|
+
* @param method - Method to perform on the object
|
|
488
|
+
* @param status - Array that receives the status, error code, and perform response of the API call (e.g. [0, 0, 0])
|
|
489
|
+
* @param options - API configure options to include in the call. Can contain a null value.
|
|
490
|
+
* @example
|
|
491
|
+
* var StatusAndRequestID = [0, 0, 0];
|
|
492
|
+
* var result = Platform.Function.InvokePerform(APIObject, "Validate", StatusAndRequestID, null);
|
|
493
|
+
* var statusMessage = StatusAndRequestID[0];
|
|
494
|
+
* var errorCode = StatusAndRequestID[1];
|
|
495
|
+
* var performResponse = StatusAndRequestID[2];
|
|
496
|
+
*/
|
|
43
497
|
function InvokePerform(apiObject: object, method: string, status: any[], options: object): object;
|
|
498
|
+
/**
|
|
499
|
+
* Executes a SOAP API Configure call on an API object.
|
|
500
|
+
*
|
|
501
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokeconfigure/)
|
|
502
|
+
*
|
|
503
|
+
* @param apiObject - SOAP API object instance
|
|
504
|
+
* @param method - Method to perform on the object
|
|
505
|
+
* @param status - Array that receives the status and request ID of the API call (e.g. [0, 0])
|
|
506
|
+
* @param options - API configure options to include in the call. Can contain a null value.
|
|
507
|
+
* @example
|
|
508
|
+
* var StatusAndRequestID = [0, 0];
|
|
509
|
+
* var result = Platform.Function.InvokeConfigure(ConfigureObject, "create", StatusAndRequestID, null);
|
|
510
|
+
*/
|
|
44
511
|
function InvokeConfigure(apiObject: object, method: string, status: any[], options: object): object;
|
|
512
|
+
/**
|
|
513
|
+
* Executes a SOAP API Execute call on an API object.
|
|
514
|
+
*
|
|
515
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokeexecute/)
|
|
516
|
+
*
|
|
517
|
+
* @param apiObject - SOAP API object instance
|
|
518
|
+
* @param status - Array that receives the status and request ID of the API call (e.g. [0, 0])
|
|
519
|
+
* @param options - API configure options to include in the call. Can contain a null value.
|
|
520
|
+
* @example
|
|
521
|
+
* var StatusAndRequestID = [0, 0];
|
|
522
|
+
* var result = Platform.Function.InvokeExecute(ExecuteRequest, StatusAndRequestID, null);
|
|
523
|
+
* var status = StatusAndRequestID[0];
|
|
524
|
+
* var requestID = StatusAndRequestID[1];
|
|
525
|
+
*/
|
|
45
526
|
function InvokeExecute(apiObject: object, status: any[], options: object): object;
|
|
527
|
+
/**
|
|
528
|
+
* Invokes the Extract SOAP API method on the specified object.
|
|
529
|
+
*
|
|
530
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokeextract/)
|
|
531
|
+
*
|
|
532
|
+
* @param apiObject - SOAP API object on which to invoke Extract
|
|
533
|
+
* @param statusArray - Array that receives the status and RequestID of the API call
|
|
534
|
+
* @param options - Additional API options; may be null
|
|
535
|
+
* @example
|
|
536
|
+
* var statusArr = [];
|
|
537
|
+
* var result = Platform.Function.InvokeExtract(extractObj, statusArr);
|
|
538
|
+
* Write(result);
|
|
539
|
+
*/
|
|
46
540
|
function InvokeExtract(apiObject: object, statusArray: any[], options?: object): string;
|
|
541
|
+
/**
|
|
542
|
+
* Invokes the Schedule SOAP API method on the specified object.
|
|
543
|
+
*
|
|
544
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokeschedule/)
|
|
545
|
+
*
|
|
546
|
+
* @param apiObject - SOAP API object on which to invoke Schedule
|
|
547
|
+
* @param action - Action to perform on the object
|
|
548
|
+
* @param schedule - Schedule definition object
|
|
549
|
+
* @param statusArray - Array that receives the status and RequestID of the API call
|
|
550
|
+
* @param options - Additional API options; may be null
|
|
551
|
+
* @example
|
|
552
|
+
* var statusArr = [];
|
|
553
|
+
* var result = Platform.Function.InvokeSchedule(sendDef, "start", scheduleDef, statusArr);
|
|
554
|
+
* Write(result);
|
|
555
|
+
*/
|
|
47
556
|
function InvokeSchedule(apiObject: object, action: string, schedule: object, statusArray?: any[], options?: object): string;
|
|
557
|
+
/**
|
|
558
|
+
* Performs an HTTP GET request and returns the response body. Only works with HTTP on port 80 and HTTPS on port 443. Times out after 30 seconds.
|
|
559
|
+
*
|
|
560
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/httpget/)
|
|
561
|
+
*
|
|
562
|
+
* @param url - URL to request
|
|
563
|
+
* @param continueOnError - When true, the request terminates if an error occurs. When false, the request continues on error.
|
|
564
|
+
* @param emptyContentHandling - How to handle a URL that returns empty content: 0 = allow empty, 1 = return error, 2 = skip subscriber
|
|
565
|
+
* @param headerNames - Array of header names to include in the GET request
|
|
566
|
+
* @param headerValues - Array of header values corresponding to headerNames
|
|
567
|
+
* @param statusVariable - Array that receives the status code: 0 = success, -1 = URL not found, -2 = HTTP error, -3 = success but no content
|
|
568
|
+
* @example
|
|
569
|
+
* var status = [0];
|
|
570
|
+
* var content = Platform.Function.HTTPGet(
|
|
571
|
+
* "https://api.example.com/data",
|
|
572
|
+
* false,
|
|
573
|
+
* 0,
|
|
574
|
+
* ["x-request-id"],
|
|
575
|
+
* ["sampleValue"],
|
|
576
|
+
* status
|
|
577
|
+
* );
|
|
578
|
+
* if (status[0] === 0) {
|
|
579
|
+
* var obj = Platform.Function.ParseJSON(content);
|
|
580
|
+
* }
|
|
581
|
+
*/
|
|
48
582
|
function HTTPGet(url: string, continueOnError: boolean, emptyContentHandling?: number, headerNames?: string[], headerValues?: string[], statusVariable?: number[]): string;
|
|
583
|
+
/**
|
|
584
|
+
* Performs an HTTP POST request with a content type and payload. Only works with HTTP on port 80 and HTTPS on port 443. Times out after 30 seconds. Returns the HTTP status code (e.g. 200 for success).
|
|
585
|
+
*
|
|
586
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/httppost/)
|
|
587
|
+
*
|
|
588
|
+
* @param url - URL to post to
|
|
589
|
+
* @param contentType - MIME type of the request body
|
|
590
|
+
* @param payload - Request body content
|
|
591
|
+
* @param headerNames - Array of header names
|
|
592
|
+
* @param headerValues - Array of header values corresponding to headerNames
|
|
593
|
+
* @param response - Array that receives the response body from the POST request
|
|
594
|
+
* @example
|
|
595
|
+
* var headerNames = ["Authorization"];
|
|
596
|
+
* var headerValues = ["Bearer " + accessToken];
|
|
597
|
+
* var response;
|
|
598
|
+
* var statusCode = Platform.Function.HTTPPost(
|
|
599
|
+
* "https://api.example.com/items",
|
|
600
|
+
* "application/json",
|
|
601
|
+
* Stringify({ name: "Jane", status: "active" }),
|
|
602
|
+
* headerNames,
|
|
603
|
+
* headerValues,
|
|
604
|
+
* response
|
|
605
|
+
* );
|
|
606
|
+
* if (statusCode == 200) { Write(response[0]); }
|
|
607
|
+
*/
|
|
49
608
|
function HTTPPost(url: string, contentType: string, payload: string, headerNames?: string[], headerValues?: string[], response?: any[]): number;
|
|
609
|
+
/**
|
|
610
|
+
* Parses a JSON-formatted string (or array of strings) and returns the resulting JavaScript object (or array of objects). SFMC-native equivalent of JSON.parse(), which is not available in the legacy SSJS engine.
|
|
611
|
+
*
|
|
612
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/parsejson/)
|
|
613
|
+
*
|
|
614
|
+
* @param jsonString - A valid JSON-formatted string or array of JSON strings to parse
|
|
615
|
+
* @example
|
|
616
|
+
* var jsonString = '{"name":"Jane","age":30}';
|
|
617
|
+
* var obj = Platform.Function.ParseJSON(jsonString);
|
|
618
|
+
* Write(obj.name); // outputs: Jane
|
|
619
|
+
*
|
|
620
|
+
* // Use String() to convert CLR response content before parsing:
|
|
621
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
622
|
+
* req.method = "GET";
|
|
623
|
+
* var resp = req.send();
|
|
624
|
+
* var result = Platform.Function.ParseJSON(String(resp.content));
|
|
625
|
+
*/
|
|
50
626
|
function ParseJSON(jsonString: string | string[]): object | object[];
|
|
627
|
+
/**
|
|
628
|
+
* Specifies the target of an email link as a complete URL stored in an attribute, data extension field, or variable. Use only within the href attribute of an anchor tag in HTML emails. In text emails, add the http:// prefix without spaces inside the parentheses. Include anchor tags in the email body (not in retrieved link content) to retain click-tracking.
|
|
629
|
+
*
|
|
630
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/redirectto/)
|
|
631
|
+
*
|
|
632
|
+
* @param url - The URL to redirect to
|
|
633
|
+
* @example
|
|
634
|
+
* var email = "aruiz@example.com";
|
|
635
|
+
* var firstName = "Angela";
|
|
636
|
+
* var baseUrl = "https://example.com?email=";
|
|
637
|
+
* var nameJoin = "&name=";
|
|
638
|
+
* Platform.Function.RedirectTo(baseUrl.concat(email, nameJoin, firstName));
|
|
639
|
+
* // Use inside href: <a href="%%=RedirectTo(...)=%%">link</a>
|
|
640
|
+
*/
|
|
51
641
|
function RedirectTo(url: string): void;
|
|
642
|
+
/**
|
|
643
|
+
* Percent-encodes a complete URL. When encodeReservedKeywords is false (default), only space characters are encoded as %20. When true, all URL-reserved characters are also encoded (spaces become +).
|
|
644
|
+
*
|
|
645
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/urlencode/)
|
|
646
|
+
*
|
|
647
|
+
* @param url - The complete URL to encode
|
|
648
|
+
* @param encodeReservedKeywords - When true, encodes all reserved characters; spaces become +. When false (default), only spaces are encoded as %20.
|
|
649
|
+
* @example
|
|
650
|
+
* var baseURL = "http://www.example.com?value=12+3 12;3";
|
|
651
|
+
* var encoded = Platform.Function.UrlEncode(baseURL);
|
|
652
|
+
* Write(encoded); // "http://www.example.com?value=12+3%2012;3"
|
|
653
|
+
* var encodedFull = Platform.Function.UrlEncode(baseURL, true);
|
|
654
|
+
* Write(encodedFull); // "http://www.example.com?value%3d12%2b3+12%3b3"
|
|
655
|
+
*/
|
|
52
656
|
function UrlEncode(url: string, encodeReservedKeywords?: boolean): string;
|
|
657
|
+
/**
|
|
658
|
+
* Encodes any string value to Base64. Note: values encoded with this function can only be decoded using `Platform.Function.Base64Decode()` or `Base64Decode()` — not other Base64 decoders. For a simpler single-parameter form without charset control, see `Base64Encode()`.
|
|
659
|
+
*
|
|
660
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/base64encode/)
|
|
661
|
+
*
|
|
662
|
+
* @param string - String to encode
|
|
663
|
+
* @param charset - Character set to use when encoding, such as ASCII or UTF-8
|
|
664
|
+
* @example
|
|
665
|
+
* var normalStr = Platform.Function.Lookup("ForBase64Info","ReceiptData","ReceiptKey","stringValue");
|
|
666
|
+
* var encodedStr = Platform.Function.Base64Encode(normalStr);
|
|
667
|
+
*/
|
|
53
668
|
function Base64Encode(string: string, charset?: string): string;
|
|
669
|
+
/**
|
|
670
|
+
* Decodes a Base64-encoded string. Only works with values encoded using `Platform.Function.Base64Encode()` or `Base64Encode()` — not arbitrary Base64 strings. For a simpler single-parameter form without charset control, see `Base64Decode()`.
|
|
671
|
+
*
|
|
672
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/base64decode/)
|
|
673
|
+
*
|
|
674
|
+
* @param encodedString - Base64 encoded string to decode
|
|
675
|
+
* @param charset - Character set to use when decoding, such as ASCII or UTF-8
|
|
676
|
+
* @example
|
|
677
|
+
* var encodedStr = Platform.Function.Lookup("forBase64Info","ReceiptData","ReceiptKey","stringValue");
|
|
678
|
+
* var decodedStr = Platform.Function.Base64Decode(encodedStr);
|
|
679
|
+
*/
|
|
54
680
|
function Base64Decode(encodedString: string, charset?: string): string;
|
|
681
|
+
/**
|
|
682
|
+
* Returns an MD5 hash for a given string value.
|
|
683
|
+
*
|
|
684
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/md5/)
|
|
685
|
+
*
|
|
686
|
+
* @param string - String to evaluate
|
|
687
|
+
* @param charset - Character set to use when evaluating, such as ASCII or UTF-8
|
|
688
|
+
* @example
|
|
689
|
+
* var normalStr = Platform.Function.Lookup("ForMD5Info","HashData","HashKey","stringValue");
|
|
690
|
+
* var hashedStr = Platform.Function.MD5(normalStr);
|
|
691
|
+
*/
|
|
55
692
|
function MD5(string: string, charset?: string): string;
|
|
693
|
+
/**
|
|
694
|
+
* Converts a JavaScript object into its JSON string representation. Works only with known JSON-serializable types. Not to be confused with `String()`, which converts CLR response objects to plain strings.
|
|
695
|
+
*
|
|
696
|
+
* [ssjs.guide reference](https://ssjs.guide/global-functions/stringify/)
|
|
697
|
+
*
|
|
698
|
+
* @param object - JavaScript object to serialize to JSON.
|
|
699
|
+
* @returns JSON string representation of the object.
|
|
700
|
+
* @example
|
|
701
|
+
* var json = Platform.Function.Stringify({ name: "Jane", age: 30 });
|
|
702
|
+
* Platform.Function.Write(json);
|
|
703
|
+
*/
|
|
56
704
|
function Stringify(object: object): string;
|
|
57
705
|
/**
|
|
706
|
+
* Retrieves content from a specified classic Content Area by numeric ID. Deprecated — Content Areas are no longer supported on current SFMC infrastructure.
|
|
707
|
+
*
|
|
708
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentarea/)
|
|
709
|
+
*
|
|
58
710
|
* @deprecated
|
|
711
|
+
* @param id - Numeric ID of the Content Area.
|
|
712
|
+
* @param regionName - Impression region for content.
|
|
713
|
+
* @param stopOnError - When true, throws on failure; when false the call proceeds.
|
|
714
|
+
* @param fallbackContent - Default content to display when the area cannot be retrieved.
|
|
715
|
+
* @returns Rendered content from the Content Area.
|
|
716
|
+
* @example
|
|
717
|
+
* var content = Platform.Function.ContentArea(123456, "impressionRegion", false, "defaultContentHere");
|
|
59
718
|
*/
|
|
60
719
|
function ContentArea(id: number, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
|
|
61
720
|
/**
|
|
721
|
+
* Retrieves content from a specified classic Content Area by name. Deprecated — Content Areas are no longer supported on current SFMC infrastructure.
|
|
722
|
+
*
|
|
723
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentareabyname/)
|
|
724
|
+
*
|
|
62
725
|
* @deprecated
|
|
726
|
+
* @param name - Name of the Content Area.
|
|
727
|
+
* @param regionName - Impression region for content.
|
|
728
|
+
* @param stopOnError - When true, throws on failure; when false the call proceeds.
|
|
729
|
+
* @param fallbackContent - Default content to display when the area cannot be retrieved.
|
|
730
|
+
* @returns Rendered content from the Content Area.
|
|
731
|
+
* @example
|
|
732
|
+
* var content = Platform.Function.ContentAreaByName("My Content\\myContentArea", "impressionRegion", false, "defaultContentHere");
|
|
63
733
|
*/
|
|
64
734
|
function ContentAreaByName(name: string, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
|
|
735
|
+
/**
|
|
736
|
+
* Indicates whether the passed-in user-agent value represents a CHTML browser. CHTML browsers (e.g. feature phones) use a modified version of HTML. Returns true when the user agent is a CHTML browser.
|
|
737
|
+
*
|
|
738
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/ischtmlbrowser/)
|
|
739
|
+
*
|
|
740
|
+
* @param userAgentString - User-agent string to evaluate.
|
|
741
|
+
* @returns True if the user agent represents a CHTML browser.
|
|
742
|
+
* @example
|
|
743
|
+
* Platform.Response.Write(Platform.Request.UserAgent);
|
|
744
|
+
* Platform.Response.Write("<br>Is CHTML: ");
|
|
745
|
+
* Platform.Response.Write(Platform.Function.IsCHTMLBrowser(Platform.Request.UserAgent));
|
|
746
|
+
*/
|
|
65
747
|
function IsCHTMLBrowser(userAgentString: string): boolean;
|
|
66
748
|
}
|
|
67
749
|
namespace Variable {
|
|
750
|
+
/**
|
|
751
|
+
* Retrieves the value of an AMPscript variable from the SSJS context.
|
|
752
|
+
*
|
|
753
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-variable/)
|
|
754
|
+
*
|
|
755
|
+
* @param variableName - Name of the AMPscript variable
|
|
756
|
+
* @example
|
|
757
|
+
* var sk = Platform.Variable.GetValue("SubscriberKey");
|
|
758
|
+
* Write(sk);
|
|
759
|
+
* // Bare-name alias: Variable.GetValue("SubscriberKey")
|
|
760
|
+
*/
|
|
68
761
|
function GetValue(variableName: string): string;
|
|
762
|
+
/**
|
|
763
|
+
* Assigns a value to an AMPscript variable from the SSJS context.
|
|
764
|
+
*
|
|
765
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-variable/)
|
|
766
|
+
*
|
|
767
|
+
* @param variableName - Name of the AMPscript variable
|
|
768
|
+
* @param value - Value to assign
|
|
769
|
+
* @example
|
|
770
|
+
* Platform.Variable.SetValue("greeting", "Hello from SSJS");
|
|
771
|
+
* // @greeting is now available in subsequent AMPscript blocks
|
|
772
|
+
* // Bare-name alias: Variable.SetValue("greeting", "Hello from SSJS")
|
|
773
|
+
*/
|
|
69
774
|
function SetValue(variableName: string, value: string): void;
|
|
70
775
|
}
|
|
71
776
|
namespace Response {
|
|
777
|
+
/**
|
|
778
|
+
* Sets a response header on the current page response.
|
|
779
|
+
*
|
|
780
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-response/)
|
|
781
|
+
*
|
|
782
|
+
* @param headerName - Name of the response header.
|
|
783
|
+
* @param value - Value for the response header.
|
|
784
|
+
* @example
|
|
785
|
+
* Platform.Response.SetResponseHeader("Content-Type", "application/json");
|
|
786
|
+
* Platform.Response.Write(Stringify({ status: "ok" }));
|
|
787
|
+
*/
|
|
72
788
|
function SetResponseHeader(headerName: string, value: string): void;
|
|
789
|
+
/**
|
|
790
|
+
* Removes a previously set HTTP response header from the response.
|
|
791
|
+
*
|
|
792
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-response/)
|
|
793
|
+
*
|
|
794
|
+
* @param headerName - Name of the HTTP response header to remove.
|
|
795
|
+
* @example
|
|
796
|
+
* Platform.Response.RemoveResponseHeader("X-Powered-By");
|
|
797
|
+
*/
|
|
73
798
|
function RemoveResponseHeader(headerName: string): void;
|
|
799
|
+
/**
|
|
800
|
+
* Redirects the current page to a new URL. Pass false for a 302 temporary redirect or true for a 301 permanent redirect. Do not use 301 if you want browsers to re-check the original URL later.
|
|
801
|
+
*
|
|
802
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-response/)
|
|
803
|
+
*
|
|
804
|
+
* @param url - URL to redirect to.
|
|
805
|
+
* @param movedPermanently - True for 301 permanent redirect, false for 302 temporary.
|
|
806
|
+
* @example
|
|
807
|
+
* Platform.Response.Redirect("https://pub.pages.example.com/thank-you", false);
|
|
808
|
+
*/
|
|
74
809
|
function Redirect(url: string, movedPermanently: boolean): void;
|
|
810
|
+
/**
|
|
811
|
+
* Sets a cookie on the client browser response.
|
|
812
|
+
*
|
|
813
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-response/)
|
|
814
|
+
*
|
|
815
|
+
* @param name - Name of the cookie to set.
|
|
816
|
+
* @param value - Value to store in the cookie.
|
|
817
|
+
* @param expires - Expiration date/time for the cookie.
|
|
818
|
+
* @param secure - If true, the cookie is only sent over HTTPS.
|
|
819
|
+
* @example
|
|
820
|
+
* Platform.Response.SetCookie("userId", subscriberKey, "12/31/2025", true);
|
|
821
|
+
*/
|
|
75
822
|
function SetCookie(name: string, value: string, expires?: string, secure?: boolean): void;
|
|
823
|
+
/**
|
|
824
|
+
* Removes a cookie from the client browser by setting its expiration to a past date.
|
|
825
|
+
*
|
|
826
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-response/)
|
|
827
|
+
*
|
|
828
|
+
* @param name - Name of the cookie to remove.
|
|
829
|
+
* @example
|
|
830
|
+
* Platform.Response.RemoveCookie("userId");
|
|
831
|
+
*/
|
|
76
832
|
function RemoveCookie(name: string): void;
|
|
833
|
+
/**
|
|
834
|
+
* Writes content to the HTTP response output. Distinct from the bare-name `Write()``, which write to the rendered page output.
|
|
835
|
+
*
|
|
836
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-response/)
|
|
837
|
+
*
|
|
838
|
+
* @param content - Content string to write to the response.
|
|
839
|
+
* @example
|
|
840
|
+
* var data = { name: "Jane", status: "active" };
|
|
841
|
+
* Platform.Response.Write(Stringify(data));
|
|
842
|
+
*/
|
|
77
843
|
function Write(content: string): void;
|
|
78
844
|
var ContentType: string;
|
|
79
845
|
var CharacterSet: string;
|
|
80
846
|
}
|
|
81
847
|
namespace Request {
|
|
848
|
+
/**
|
|
849
|
+
* Retrieves the value of a URL query string parameter.
|
|
850
|
+
*
|
|
851
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
852
|
+
*
|
|
853
|
+
* @param parameterName - Name of the query string parameter.
|
|
854
|
+
* @example
|
|
855
|
+
* // Page URL: /mypage?email=jane@example.com
|
|
856
|
+
* var email = Platform.Request.GetQueryStringParameter("email");
|
|
857
|
+
* Write(email);
|
|
858
|
+
*/
|
|
82
859
|
function GetQueryStringParameter(parameterName: string): string;
|
|
860
|
+
/**
|
|
861
|
+
* Retrieves data from a named form field, including values sent via POST.
|
|
862
|
+
*
|
|
863
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
864
|
+
*
|
|
865
|
+
* @param name - Name of the form field to retrieve.
|
|
866
|
+
* @example
|
|
867
|
+
* var email = Platform.Request.GetFormField("emailAddress");
|
|
868
|
+
* Write(email);
|
|
869
|
+
*/
|
|
83
870
|
function GetFormField(name: string): string;
|
|
871
|
+
/**
|
|
872
|
+
* Returns the raw body of the HTTP POST request. CAVEAT: Only returns data on the FIRST call per request; subsequent calls return nothing. Store the result in a variable if you need it multiple times.
|
|
873
|
+
*
|
|
874
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
875
|
+
*
|
|
876
|
+
* @param encoding - Character encoding for the post data.
|
|
877
|
+
* @example
|
|
878
|
+
* // Read raw POST body once and store it:
|
|
879
|
+
* var rawBody = Platform.Request.GetPostData();
|
|
880
|
+
* var payload = Platform.Function.ParseJSON(rawBody);
|
|
881
|
+
*/
|
|
84
882
|
function GetPostData(encoding?: string): string;
|
|
883
|
+
/**
|
|
884
|
+
* Retrieves the value of a named cookie from the HTTP request sent by the client browser.
|
|
885
|
+
*
|
|
886
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
887
|
+
*
|
|
888
|
+
* @param cookieName - Name of the cookie to retrieve.
|
|
889
|
+
* @example
|
|
890
|
+
* var sessionId = Platform.Request.GetCookieValue("sessionId");
|
|
891
|
+
* if (sessionId) { Write("Session: " + sessionId); }
|
|
892
|
+
*/
|
|
85
893
|
function GetCookieValue(cookieName: string): string;
|
|
894
|
+
/**
|
|
895
|
+
* Returns the language preferences of the client browser as specified in the HTTP Accept-Language request header.
|
|
896
|
+
*
|
|
897
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
898
|
+
*
|
|
899
|
+
* @example
|
|
900
|
+
* var lang = Platform.Request.GetUserLanguages();
|
|
901
|
+
* Write(lang); // e.g. "en-US,en;q=0.9"
|
|
902
|
+
*/
|
|
86
903
|
function GetUserLanguages(): string;
|
|
904
|
+
/**
|
|
905
|
+
* Returns the value of the named HTTP request header, or null if not present.
|
|
906
|
+
*
|
|
907
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
908
|
+
*
|
|
909
|
+
* @param headerName - Name of the HTTP request header to retrieve.
|
|
910
|
+
* @example
|
|
911
|
+
* var auth = Platform.Request.GetRequestHeader("Authorization");
|
|
912
|
+
* if (auth) { Write("Auth: " + auth); }
|
|
913
|
+
*/
|
|
87
914
|
function GetRequestHeader(headerName: string): string;
|
|
88
915
|
const Browser: object;
|
|
89
916
|
const ClientIP: string;
|
|
@@ -96,653 +923,2382 @@ declare namespace Platform {
|
|
|
96
923
|
const UserAgent: string;
|
|
97
924
|
}
|
|
98
925
|
namespace Recipient {
|
|
926
|
+
/**
|
|
927
|
+
* Returns the value of a subscriber attribute or sendable data extension field for the current recipient.
|
|
928
|
+
*
|
|
929
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-recipient/)
|
|
930
|
+
*
|
|
931
|
+
* @param attributeName - Name of the subscriber attribute or sendable DE field to retrieve
|
|
932
|
+
* @example
|
|
933
|
+
* var email = Platform.Recipient.GetAttributeValue("EmailAddress");
|
|
934
|
+
* Platform.Response.Write(email);
|
|
935
|
+
*/
|
|
99
936
|
function GetAttributeValue(attributeName: string): string;
|
|
100
937
|
}
|
|
101
938
|
}
|
|
102
939
|
|
|
103
940
|
// ── Bare-name globals (aliasOf Platform.*) ──────────────────────────────────
|
|
941
|
+
declare namespace Variable {
|
|
942
|
+
/**
|
|
943
|
+
* Retrieves the value of an AMPscript variable from the SSJS context.
|
|
944
|
+
*
|
|
945
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-variable/)
|
|
946
|
+
*
|
|
947
|
+
* @param variableName - Name of the AMPscript variable
|
|
948
|
+
* @example
|
|
949
|
+
* var sk = Platform.Variable.GetValue("SubscriberKey");
|
|
950
|
+
* Write(sk);
|
|
951
|
+
* // Bare-name alias: Variable.GetValue("SubscriberKey")
|
|
952
|
+
*/
|
|
953
|
+
function GetValue(variableName: string): string;
|
|
954
|
+
/**
|
|
955
|
+
* Assigns a value to an AMPscript variable from the SSJS context.
|
|
956
|
+
*
|
|
957
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-variable/)
|
|
958
|
+
*
|
|
959
|
+
* @param variableName - Name of the AMPscript variable
|
|
960
|
+
* @param value - Value to assign
|
|
961
|
+
* @example
|
|
962
|
+
* Platform.Variable.SetValue("greeting", "Hello from SSJS");
|
|
963
|
+
* // @greeting is now available in subsequent AMPscript blocks
|
|
964
|
+
* // Bare-name alias: Variable.SetValue("greeting", "Hello from SSJS")
|
|
965
|
+
*/
|
|
966
|
+
function SetValue(variableName: string, value: string): void;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
declare namespace Request {
|
|
970
|
+
/**
|
|
971
|
+
* Retrieves the value of a URL query string parameter.
|
|
972
|
+
*
|
|
973
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
974
|
+
*
|
|
975
|
+
* @param parameterName - Name of the query string parameter.
|
|
976
|
+
* @example
|
|
977
|
+
* // Page URL: /mypage?email=jane@example.com
|
|
978
|
+
* var email = Platform.Request.GetQueryStringParameter("email");
|
|
979
|
+
* Write(email);
|
|
980
|
+
*/
|
|
981
|
+
function GetQueryStringParameter(parameterName: string): string;
|
|
982
|
+
/**
|
|
983
|
+
* Retrieves data from a named form field, including values sent via POST.
|
|
984
|
+
*
|
|
985
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
986
|
+
*
|
|
987
|
+
* @param name - Name of the form field to retrieve.
|
|
988
|
+
* @example
|
|
989
|
+
* var email = Platform.Request.GetFormField("emailAddress");
|
|
990
|
+
* Write(email);
|
|
991
|
+
*/
|
|
992
|
+
function GetFormField(name: string): string;
|
|
993
|
+
/**
|
|
994
|
+
* Returns the raw body of the HTTP POST request. CAVEAT: Only returns data on the FIRST call per request; subsequent calls return nothing. Store the result in a variable if you need it multiple times.
|
|
995
|
+
*
|
|
996
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
997
|
+
*
|
|
998
|
+
* @param encoding - Character encoding for the post data.
|
|
999
|
+
* @example
|
|
1000
|
+
* // Read raw POST body once and store it:
|
|
1001
|
+
* var rawBody = Platform.Request.GetPostData();
|
|
1002
|
+
* var payload = Platform.Function.ParseJSON(rawBody);
|
|
1003
|
+
*/
|
|
1004
|
+
function GetPostData(encoding?: string): string;
|
|
1005
|
+
/**
|
|
1006
|
+
* Retrieves the value of a named cookie from the HTTP request sent by the client browser.
|
|
1007
|
+
*
|
|
1008
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1009
|
+
*
|
|
1010
|
+
* @param cookieName - Name of the cookie to retrieve.
|
|
1011
|
+
* @example
|
|
1012
|
+
* var sessionId = Platform.Request.GetCookieValue("sessionId");
|
|
1013
|
+
* if (sessionId) { Write("Session: " + sessionId); }
|
|
1014
|
+
*/
|
|
1015
|
+
function GetCookieValue(cookieName: string): string;
|
|
1016
|
+
/**
|
|
1017
|
+
* Returns the language preferences of the client browser as specified in the HTTP Accept-Language request header.
|
|
1018
|
+
*
|
|
1019
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1020
|
+
*
|
|
1021
|
+
* @example
|
|
1022
|
+
* var lang = Platform.Request.GetUserLanguages();
|
|
1023
|
+
* Write(lang); // e.g. "en-US,en;q=0.9"
|
|
1024
|
+
*/
|
|
1025
|
+
function GetUserLanguages(): string;
|
|
1026
|
+
/**
|
|
1027
|
+
* Returns the value of the named HTTP request header, or null if not present.
|
|
1028
|
+
*
|
|
1029
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1030
|
+
*
|
|
1031
|
+
* @param headerName - Name of the HTTP request header to retrieve.
|
|
1032
|
+
* @example
|
|
1033
|
+
* var auth = Platform.Request.GetRequestHeader("Authorization");
|
|
1034
|
+
* if (auth) { Write("Auth: " + auth); }
|
|
1035
|
+
*/
|
|
1036
|
+
function GetRequestHeader(headerName: string): string;
|
|
1037
|
+
/**
|
|
1038
|
+
* Returns an object describing the client browser.
|
|
1039
|
+
*
|
|
1040
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1041
|
+
*
|
|
1042
|
+
* @example
|
|
1043
|
+
* var browser = Platform.Request.Browser;
|
|
1044
|
+
* Write(Stringify(browser));
|
|
1045
|
+
*/
|
|
1046
|
+
var Browser: object;
|
|
1047
|
+
/**
|
|
1048
|
+
* Returns the IP address of the client.
|
|
1049
|
+
*
|
|
1050
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1051
|
+
*
|
|
1052
|
+
* @example
|
|
1053
|
+
* Write(Platform.Request.ClientIP);
|
|
1054
|
+
*/
|
|
1055
|
+
var ClientIP: string;
|
|
1056
|
+
/**
|
|
1057
|
+
* Returns true if the current request was made over HTTPS.
|
|
1058
|
+
*
|
|
1059
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1060
|
+
*
|
|
1061
|
+
* @example
|
|
1062
|
+
* if (Platform.Request.HasSSL) {
|
|
1063
|
+
* Write("Secure connection");
|
|
1064
|
+
* } else {
|
|
1065
|
+
* Platform.Response.Redirect("https://" + Platform.Request.RequestURL);
|
|
1066
|
+
* }
|
|
1067
|
+
*/
|
|
1068
|
+
var HasSSL: boolean;
|
|
1069
|
+
/**
|
|
1070
|
+
* Returns true if the current request was made over HTTPS (alias of HasSSL).
|
|
1071
|
+
*
|
|
1072
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1073
|
+
*
|
|
1074
|
+
* @example
|
|
1075
|
+
* Write(Platform.Request.IsSSL);
|
|
1076
|
+
*/
|
|
1077
|
+
var IsSSL: boolean;
|
|
1078
|
+
/**
|
|
1079
|
+
* Returns the HTTP method (GET, POST, etc.) of the current request.
|
|
1080
|
+
*
|
|
1081
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1082
|
+
*
|
|
1083
|
+
* @example
|
|
1084
|
+
* var method = Platform.Request.Method;
|
|
1085
|
+
* if (method === "POST") {
|
|
1086
|
+
* var body = Platform.Request.GetPostData();
|
|
1087
|
+
* // handle POST
|
|
1088
|
+
* }
|
|
1089
|
+
*/
|
|
1090
|
+
var Method: string;
|
|
1091
|
+
/**
|
|
1092
|
+
* Returns the full query string of the current request URL.
|
|
1093
|
+
*
|
|
1094
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1095
|
+
*
|
|
1096
|
+
* @example
|
|
1097
|
+
* Write(Platform.Request.QueryString);
|
|
1098
|
+
*/
|
|
1099
|
+
var QueryString: string;
|
|
1100
|
+
/**
|
|
1101
|
+
* Returns the referrer URL from the HTTP Referer header.
|
|
1102
|
+
*
|
|
1103
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1104
|
+
*
|
|
1105
|
+
* @example
|
|
1106
|
+
* Write(Platform.Request.ReferrerURL);
|
|
1107
|
+
*/
|
|
1108
|
+
var ReferrerURL: string;
|
|
1109
|
+
/**
|
|
1110
|
+
* Returns the full URL of the current page request.
|
|
1111
|
+
*
|
|
1112
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1113
|
+
*
|
|
1114
|
+
* @example
|
|
1115
|
+
* Write("Current page: " + Platform.Request.RequestURL);
|
|
1116
|
+
*/
|
|
1117
|
+
var RequestURL: string;
|
|
1118
|
+
/**
|
|
1119
|
+
* Returns the user-agent string from the HTTP request.
|
|
1120
|
+
*
|
|
1121
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1122
|
+
*
|
|
1123
|
+
* @example
|
|
1124
|
+
* Write(Platform.Request.UserAgent);
|
|
1125
|
+
*/
|
|
1126
|
+
var UserAgent: string;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
declare namespace Recipient {
|
|
1130
|
+
/**
|
|
1131
|
+
* Returns the value of a subscriber attribute or sendable data extension field for the current recipient.
|
|
1132
|
+
*
|
|
1133
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-recipient/)
|
|
1134
|
+
*
|
|
1135
|
+
* @param attributeName - Name of the subscriber attribute or sendable DE field to retrieve
|
|
1136
|
+
* @example
|
|
1137
|
+
* var email = Platform.Recipient.GetAttributeValue("EmailAddress");
|
|
1138
|
+
* Platform.Response.Write(email);
|
|
1139
|
+
*/
|
|
1140
|
+
function GetAttributeValue(attributeName: string): string;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
104
1143
|
/**
|
|
1144
|
+
* Retrieves content from a specified classic Content Area by numeric ID. Deprecated — Content Areas are no longer supported on current SFMC infrastructure.
|
|
1145
|
+
*
|
|
1146
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentarea/)
|
|
1147
|
+
*
|
|
105
1148
|
* @deprecated
|
|
1149
|
+
* @param id - Numeric ID of the Content Area.
|
|
1150
|
+
* @param regionName - Impression region for content.
|
|
1151
|
+
* @param stopOnError - When true, throws on failure; when false the call proceeds.
|
|
1152
|
+
* @param fallbackContent - Default content to display when the area cannot be retrieved.
|
|
1153
|
+
* @returns Rendered content from the Content Area.
|
|
1154
|
+
* @example
|
|
1155
|
+
* var content = Platform.Function.ContentArea(123456, "impressionRegion", false, "defaultContentHere");
|
|
106
1156
|
*/
|
|
107
1157
|
declare function ContentArea(id: number, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
|
|
108
1158
|
/**
|
|
1159
|
+
* Retrieves content from a specified classic Content Area by name. Deprecated — Content Areas are no longer supported on current SFMC infrastructure.
|
|
1160
|
+
*
|
|
1161
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentareabyname/)
|
|
1162
|
+
*
|
|
109
1163
|
* @deprecated
|
|
1164
|
+
* @param name - Name of the Content Area.
|
|
1165
|
+
* @param regionName - Impression region for content.
|
|
1166
|
+
* @param stopOnError - When true, throws on failure; when false the call proceeds.
|
|
1167
|
+
* @param fallbackContent - Default content to display when the area cannot be retrieved.
|
|
1168
|
+
* @returns Rendered content from the Content Area.
|
|
1169
|
+
* @example
|
|
1170
|
+
* var content = Platform.Function.ContentAreaByName("My Content\\myContentArea", "impressionRegion", false, "defaultContentHere");
|
|
110
1171
|
*/
|
|
111
1172
|
declare function ContentAreaByName(name: string, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
|
|
112
1173
|
/**
|
|
1174
|
+
* Marks the start of a named impression tracking region within content.
|
|
1175
|
+
*
|
|
1176
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/beginimpressionregion/)
|
|
1177
|
+
*
|
|
113
1178
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1179
|
+
* @param name - Name identifying the impression region
|
|
1180
|
+
* @example
|
|
1181
|
+
* Platform.Function.BeginImpressionRegion("hero-banner");
|
|
1182
|
+
* Write(heroContent);
|
|
1183
|
+
* Platform.Function.EndImpressionRegion();
|
|
114
1184
|
*/
|
|
115
1185
|
declare function BeginImpressionRegion(name: string): void;
|
|
116
1186
|
/**
|
|
1187
|
+
* Marks the end of an impression tracking region within content.
|
|
1188
|
+
*
|
|
1189
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/endimpressionregion/)
|
|
1190
|
+
*
|
|
117
1191
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1192
|
+
* @param closeAll - When true, closes all nested impression regions
|
|
1193
|
+
* @example
|
|
1194
|
+
* Platform.Function.BeginImpressionRegion("footer");
|
|
1195
|
+
* Write(footerContent);
|
|
1196
|
+
* Platform.Function.EndImpressionRegion();
|
|
118
1197
|
*/
|
|
119
1198
|
declare function EndImpressionRegion(closeAll?: boolean): void;
|
|
120
1199
|
/**
|
|
1200
|
+
* Returns the current system timestamp, or the timestamp of the triggering send when called with true.
|
|
1201
|
+
*
|
|
1202
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/now/)
|
|
1203
|
+
*
|
|
121
1204
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1205
|
+
* @param useContextTime - When true, returns the time the triggering send or activity was initiated. When false or omitted, returns the current system clock time.
|
|
1206
|
+
* @example
|
|
1207
|
+
* var current = Platform.Function.Now();
|
|
1208
|
+
* Write(current); // e.g. "8/5/2025 12:00:00 PM"
|
|
1209
|
+
*
|
|
1210
|
+
* // Use context time during triggered sends:
|
|
1211
|
+
* var sendTime = Platform.Function.Now(true);
|
|
122
1212
|
*/
|
|
123
1213
|
declare function Now(useContextTime?: boolean): string;
|
|
124
1214
|
/**
|
|
1215
|
+
* Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.
|
|
1216
|
+
*
|
|
1217
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/systemdatetolocaldate/)
|
|
1218
|
+
*
|
|
125
1219
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1220
|
+
* @param dateValue - Date-time string in system time (CST)
|
|
1221
|
+
* @example
|
|
1222
|
+
* var systemDate = Platform.Function.Now();
|
|
1223
|
+
* var localDate = Platform.Function.SystemDateToLocalDate(systemDate);
|
|
1224
|
+
* Write(localDate);
|
|
126
1225
|
*/
|
|
127
1226
|
declare function SystemDateToLocalDate(dateValue: string): string;
|
|
128
1227
|
/**
|
|
1228
|
+
* Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).
|
|
1229
|
+
*
|
|
1230
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/localdatetosystemdate/)
|
|
1231
|
+
*
|
|
129
1232
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1233
|
+
* @param dateValue - Date-time string in local account/user time
|
|
1234
|
+
* @example
|
|
1235
|
+
* var localDate = "8/5/2025 12:00:00 PM";
|
|
1236
|
+
* var systemDate = Platform.Function.LocalDateToSystemDate(localDate);
|
|
1237
|
+
* Write(systemDate);
|
|
130
1238
|
*/
|
|
131
1239
|
declare function LocalDateToSystemDate(dateValue: string): string;
|
|
132
1240
|
/**
|
|
1241
|
+
* Redirects the current page to a new URL. Pass false for a 302 temporary redirect or true for a 301 permanent redirect. Do not use 301 if you want browsers to re-check the original URL later.
|
|
1242
|
+
*
|
|
1243
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-response/redirect/)
|
|
1244
|
+
*
|
|
133
1245
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1246
|
+
* @param url - URL to redirect to.
|
|
1247
|
+
* @param movedPermanently - True for 301 permanent redirect, false for 302 temporary.
|
|
1248
|
+
* @example
|
|
1249
|
+
* Platform.Response.Redirect("https://pub.pages.example.com/thank-you", false);
|
|
134
1250
|
*/
|
|
135
1251
|
declare function Redirect(url: string, movedPermanently: boolean): void;
|
|
136
1252
|
/**
|
|
1253
|
+
* Generates a new globally unique identifier string.
|
|
1254
|
+
*
|
|
1255
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/guid/)
|
|
1256
|
+
*
|
|
137
1257
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1258
|
+
* @example
|
|
1259
|
+
* var id = Platform.Function.GUID();
|
|
1260
|
+
* Write(id); // e.g. "550e8400-e29b-41d4-a716-446655440000"
|
|
138
1261
|
*/
|
|
139
1262
|
declare function GUID(): string;
|
|
140
1263
|
/**
|
|
1264
|
+
* Checks whether a string is a valid email address format.
|
|
1265
|
+
*
|
|
1266
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/isemailaddress/)
|
|
1267
|
+
*
|
|
141
1268
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1269
|
+
* @param value - String to validate
|
|
1270
|
+
* @example
|
|
1271
|
+
* if (Platform.Function.IsEmailAddress(emailInput)) {
|
|
1272
|
+
* Write("Valid email");
|
|
1273
|
+
* } else {
|
|
1274
|
+
* Write("Invalid email format");
|
|
1275
|
+
* }
|
|
142
1276
|
*/
|
|
143
1277
|
declare function IsEmailAddress(value: string): boolean;
|
|
144
1278
|
/**
|
|
1279
|
+
* Evaluates whether a string contains a valid phone number.
|
|
1280
|
+
*
|
|
1281
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/isphonenumber/)
|
|
1282
|
+
*
|
|
145
1283
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1284
|
+
* @param value - String to evaluate
|
|
1285
|
+
* @example
|
|
1286
|
+
* if (Platform.Function.IsPhoneNumber(phoneInput)) {
|
|
1287
|
+
* Write("Valid phone");
|
|
1288
|
+
* } else {
|
|
1289
|
+
* Write("Invalid phone number");
|
|
1290
|
+
* }
|
|
146
1291
|
*/
|
|
147
1292
|
declare function IsPhoneNumber(value: string): boolean;
|
|
148
1293
|
/**
|
|
149
|
-
*
|
|
1294
|
+
* Writes content to the HTTP response output. Distinct from the bare-name `Write()``, which write to the rendered page output.
|
|
1295
|
+
*
|
|
1296
|
+
* [ssjs.guide reference](https://ssjs.guide/global-functions/write/)
|
|
1297
|
+
*
|
|
1298
|
+
* @param content - Content string to write to the response.
|
|
1299
|
+
* @example
|
|
1300
|
+
* var data = { name: "Jane", status: "active" };
|
|
1301
|
+
* Platform.Response.Write(Stringify(data));
|
|
150
1302
|
*/
|
|
151
1303
|
declare function Write(content: string): void;
|
|
152
1304
|
/**
|
|
1305
|
+
* Converts a JavaScript object into its JSON string representation. Works only with known JSON-serializable types. Not to be confused with `String()`, which converts CLR response objects to plain strings.
|
|
1306
|
+
*
|
|
1307
|
+
* [ssjs.guide reference](https://ssjs.guide/global-functions/stringify/)
|
|
1308
|
+
*
|
|
153
1309
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1310
|
+
* @param object - JavaScript object to serialize to JSON.
|
|
1311
|
+
* @returns JSON string representation of the object.
|
|
1312
|
+
* @example
|
|
1313
|
+
* var json = Platform.Function.Stringify({ name: "Jane", age: 30 });
|
|
1314
|
+
* Platform.Function.Write(json);
|
|
154
1315
|
*/
|
|
155
1316
|
declare function Stringify(object: object): string;
|
|
156
1317
|
|
|
157
1318
|
// ── DataExtension instance interfaces ───────────────────────────────────────
|
|
158
|
-
interface
|
|
1319
|
+
interface DataExtensionFields {
|
|
159
1320
|
/**
|
|
1321
|
+
* Adds a field to the previously initialized data extension. `properties.Name` is required; the rest (`CustomerKey`, `FieldType`, `MaxLength`, `IsRequired`, `IsPrimaryKey`, `Ordinal`, `Scale`, `DefaultValue`) are optional. `FieldType` accepts: 'Boolean', 'Date', 'Decimal', 'EmailAddress', 'Locale', 'Number', 'Phone', 'Text'.
|
|
1322
|
+
*
|
|
160
1323
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1324
|
+
* @param properties - Object describing the new field.
|
|
1325
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1326
|
+
* @example
|
|
1327
|
+
* Platform.Load("core", "1.1.5");
|
|
1328
|
+
* var de = DataExtension.Init("SSJSTest");
|
|
1329
|
+
* var newField = { Name: "NewFieldV2", CustomerKey: "CustomerKey", FieldType: "Number", IsRequired: true, DefaultValue: "100" };
|
|
1330
|
+
* var status = de.Fields.Add(newField);
|
|
161
1331
|
*/
|
|
162
1332
|
Add(properties: object): string;
|
|
163
1333
|
/**
|
|
1334
|
+
* Returns an array of field definitions for the previously initialized data extension.
|
|
1335
|
+
*
|
|
164
1336
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1337
|
+
* @returns List of field-definition objects.
|
|
1338
|
+
* @example
|
|
1339
|
+
* Platform.Load("core", "1.1.5");
|
|
1340
|
+
* var birthdayDE = DataExtension.Init("birthdayDE");
|
|
1341
|
+
* var fields = birthdayDE.Fields.Retrieve();
|
|
165
1342
|
*/
|
|
166
1343
|
Retrieve(): object[];
|
|
167
1344
|
/**
|
|
1345
|
+
* Updates which data extension field is used to relate the data extension to the All Subscribers list during sending. Pass the name of the data extension field, and which subscriber attribute it should map to.
|
|
1346
|
+
*
|
|
168
1347
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1348
|
+
* @param deFieldName - Name of the data extension field that should make the connection to the subscriber list.
|
|
1349
|
+
* @param subscriberField - Subscriber attribute to map the data extension field to.
|
|
1350
|
+
* @returns Returns "OK" on success or throws on failure (assumed; doc has no `@returns`, treated as `"OK"` for consistency with sibling `Fields.*` methods).
|
|
1351
|
+
* @example
|
|
1352
|
+
* Platform.Load("core", "1.1.5");
|
|
1353
|
+
* var updateDE = DataExtension.Init("sendableDataExtension");
|
|
1354
|
+
* var status = updateDE.Fields.UpdateSendableField("DifferentSubKey", "Subscriber Key");
|
|
169
1355
|
*/
|
|
170
1356
|
UpdateSendableField(deFieldName: string, subscriberField: string): string;
|
|
171
1357
|
}
|
|
172
|
-
interface
|
|
173
|
-
/**
|
|
174
|
-
*
|
|
1358
|
+
interface DataExtensionRows {
|
|
1359
|
+
/**
|
|
1360
|
+
* Adds one or more rows to the previously initialized data extension.
|
|
1361
|
+
*
|
|
1362
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1363
|
+
* @param rowData - Array of objects, one per row to add. Each object's keys must match data extension field names.
|
|
1364
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1365
|
+
* @example
|
|
1366
|
+
* Platform.Load("core", "1.1.5");
|
|
1367
|
+
* var arrContacts = [
|
|
1368
|
+
* { Email: "jdoe@example.com", FirstName: "John", LastName: "Doe" },
|
|
1369
|
+
* { Email: "aruiz@example.com", FirstName: "Angel", LastName: "Ruiz" }
|
|
1370
|
+
* ];
|
|
1371
|
+
* var birthdayDE = DataExtension.Init("birthdayDE");
|
|
1372
|
+
* birthdayDE.Rows.Add(arrContacts);
|
|
175
1373
|
*/
|
|
176
1374
|
Add(rowData: any[]): string;
|
|
177
1375
|
/**
|
|
1376
|
+
* Returns rows where the specified columns equal the specified values (AND-joined). Optionally limits results and orders by a field. When initializing a data extension for `Lookup()` from an email message, you must use the data extension Name; on landing pages, either Name or external key works — make them identical to be safe.
|
|
1377
|
+
*
|
|
178
1378
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1379
|
+
* @param searchFieldNames - Array of column names to match against.
|
|
1380
|
+
* @param searchValues - Array of values to match (one per column, in order).
|
|
1381
|
+
* @param limit - Maximum number of rows to return.
|
|
1382
|
+
* @param orderByFieldName - Field to order results by.
|
|
1383
|
+
* @returns Rows matching the lookup criteria.
|
|
1384
|
+
* @example
|
|
1385
|
+
* Platform.Load("core", "1.1.5");
|
|
1386
|
+
* var testDE = DataExtension.Init("testDE");
|
|
1387
|
+
* var data = testDE.Rows.Lookup(["Age"], [25], 2, "LastName");
|
|
179
1388
|
*/
|
|
180
1389
|
Lookup(searchFieldNames: any[], searchValues: any[], limit?: number, orderByFieldName?: string): object[];
|
|
181
1390
|
/**
|
|
1391
|
+
* Deletes rows from the previously initialized data extension where the specified columns equal the specified values (AND-joined). For large deletion requests, batch the work — this method times out on long-running deletes.
|
|
1392
|
+
*
|
|
182
1393
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1394
|
+
* @param columnNames - Array of column names to match against.
|
|
1395
|
+
* @param columnValues - Array of values to match (one per column, in order).
|
|
1396
|
+
* @returns The number of rows that were modified (deleted).
|
|
1397
|
+
* @example
|
|
1398
|
+
* Platform.Load("Core", "1.1.5");
|
|
1399
|
+
* var memberDE = DataExtension.Init("MembershipRewards");
|
|
1400
|
+
* var result = memberDE.Rows.Remove(["Area"], ["Kensington"]);
|
|
183
1401
|
*/
|
|
184
1402
|
Remove(columnNames: any[], columnValues: any[]): number;
|
|
185
1403
|
/**
|
|
1404
|
+
* Retrieves up to 2500 rows from the previously initialized data extension. When called without a filter, returns all rows (subject to the 2500-row cap). Cannot be used in the context of an email message or email preview.
|
|
1405
|
+
*
|
|
186
1406
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1407
|
+
* @param filter - WSProxy-style filter object — simple `{Property, SimpleOperator, Value}` or compound with `LeftOperand`/`LogicalOperator`/`RightOperand`. Optional per the example, despite the doc table marking `Required: Yes`.
|
|
1408
|
+
* @returns Rows from the data extension matching the filter (or all rows when no filter is supplied).
|
|
1409
|
+
* @example
|
|
1410
|
+
* Platform.Load("core", "1.1.5");
|
|
1411
|
+
* var birthdayDE = DataExtension.Init("birthdayDE");
|
|
1412
|
+
* var data = birthdayDE.Rows.Retrieve();
|
|
1413
|
+
* var filter = { Property: "Age", SimpleOperator: "greaterThan", Value: 20 };
|
|
1414
|
+
* var moredata = birthdayDE.Rows.Retrieve(filter);
|
|
187
1415
|
*/
|
|
188
1416
|
Retrieve(filter?: object): object[];
|
|
189
1417
|
/**
|
|
1418
|
+
* Updates the columns of rows where `whereFieldNames` equal `whereValues` (AND-joined). Throws if no row matches.
|
|
1419
|
+
*
|
|
190
1420
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1421
|
+
* @param rowData - Object whose keys are columns to update and values are the new values.
|
|
1422
|
+
* @param whereFieldNames - Array of column names to match against.
|
|
1423
|
+
* @param whereValues - Array of values to match (one per column, in order).
|
|
1424
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1425
|
+
* @example
|
|
1426
|
+
* Platform.Load("Core", "1");
|
|
1427
|
+
* var dataExt = DataExtension.Init("NTO Customer List");
|
|
1428
|
+
* var fieldsToUpdate = { StateProvince: "QC", PreferredActivity: "Sailing" };
|
|
1429
|
+
* var result = dataExt.Rows.Update(fieldsToUpdate, ["MemberId", "Country"], [9868600, "CA"]);
|
|
191
1430
|
*/
|
|
192
1431
|
Update(rowData: object, whereFieldNames: any[], whereValues: any[]): string;
|
|
193
1432
|
}
|
|
194
1433
|
interface DataExtensionInstance {
|
|
195
|
-
Fields:
|
|
196
|
-
Rows:
|
|
1434
|
+
Fields: DataExtensionFields;
|
|
1435
|
+
Rows: DataExtensionRows;
|
|
197
1436
|
}
|
|
198
1437
|
|
|
199
1438
|
// ── Core Library namespaces ──────────────────────────────────────────────────
|
|
200
1439
|
declare namespace Account {
|
|
201
1440
|
/**
|
|
1441
|
+
* Initializes an Account instance bound to the specified external key. Required before invoking any other Account method on the returned instance.
|
|
1442
|
+
*
|
|
1443
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/account/)
|
|
1444
|
+
*
|
|
202
1445
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1446
|
+
* @param key - External key of the account.
|
|
1447
|
+
* @returns An initialized Account bound to the specified external key.
|
|
1448
|
+
* @example
|
|
1449
|
+
* Platform.Load("core", "1.1.5");
|
|
1450
|
+
* var myAccount = Account.Init("MyCustomerKey");
|
|
203
1451
|
*/
|
|
204
1452
|
function Init(key: string): any;
|
|
205
1453
|
/**
|
|
1454
|
+
* Retrieves accounts based on the specified filter criteria.
|
|
1455
|
+
*
|
|
1456
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/account/)
|
|
1457
|
+
*
|
|
206
1458
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1459
|
+
* @param filter - Criteria used to search for the account. Use a filter expression or a JSON object containing filter and additional search parameters.
|
|
1460
|
+
* @returns List of results matching the filter.
|
|
1461
|
+
* @example
|
|
1462
|
+
* Platform.Load("core", "1.1.5");
|
|
1463
|
+
* var getAcct = Account.Retrieve({Property:"CustomerKey",SimpleOperator:"equals",Value:"MyAccount"});
|
|
207
1464
|
*/
|
|
208
1465
|
function Retrieve(filter: object): object[];
|
|
209
1466
|
/**
|
|
1467
|
+
* Updates the account with the supplied attributes. If `properties` includes `TimeZoneID`, the call uses that value to update the account time zone.
|
|
1468
|
+
*
|
|
1469
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/account/)
|
|
1470
|
+
*
|
|
210
1471
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1472
|
+
* @param properties - Account attributes to change.
|
|
1473
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1474
|
+
* @example
|
|
1475
|
+
* Platform.Load("core", "1.1.5");
|
|
1476
|
+
* var myAccount = Account.Init("MyCustomerKey");
|
|
1477
|
+
* var status = myAccount.Update({ "FromName" : "Demo From Name" });
|
|
211
1478
|
*/
|
|
212
1479
|
function Update(properties: object): string;
|
|
213
1480
|
}
|
|
214
1481
|
declare namespace Account.Tracking {
|
|
215
1482
|
/**
|
|
1483
|
+
* Returns an array of tracking data related to the accounts specified by the passed filter argument.
|
|
1484
|
+
*
|
|
1485
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/account/)
|
|
1486
|
+
*
|
|
216
1487
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1488
|
+
* @param filter - Criteria used to search for the account.
|
|
1489
|
+
* @returns List of results matching the filter.
|
|
1490
|
+
* @example
|
|
1491
|
+
* Platform.Load("core", "1.1.5");
|
|
1492
|
+
* var acctTracking = Account.Tracking.Retrieve({Property:"CustomerKey",SimpleOperator:"equals",Value:"MyAccount"});
|
|
217
1493
|
*/
|
|
218
1494
|
function Retrieve(filter: object): object[];
|
|
219
1495
|
}
|
|
220
1496
|
declare namespace AccountUser {
|
|
221
1497
|
/**
|
|
1498
|
+
* Initializes an AccountUser instance bound to the specified external key and client ID (MID). Required before invoking any other AccountUser method on the returned instance.
|
|
1499
|
+
*
|
|
1500
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/accountuser/)
|
|
1501
|
+
*
|
|
222
1502
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1503
|
+
* @param targetUserKey - External key of the user.
|
|
1504
|
+
* @param myClientID - MID of the business unit.
|
|
1505
|
+
* @returns An initialized AccountUser bound to the specified external key and client ID.
|
|
1506
|
+
* @example
|
|
1507
|
+
* Platform.Load("core", "1.1.5");
|
|
1508
|
+
* var acctUser = AccountUser.Init("myAccountUser", 123456789);
|
|
223
1509
|
*/
|
|
224
1510
|
function Init(targetUserKey: string, myClientID: number): any;
|
|
225
1511
|
/**
|
|
226
|
-
*
|
|
1512
|
+
* Creates a new account user from the supplied properties object.
|
|
1513
|
+
*
|
|
1514
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/accountuser/)
|
|
1515
|
+
*
|
|
1516
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1517
|
+
* @param properties - JSON object describing the new account user (Name, UserID, Password, Email, ClientID, DefaultBusinessUnitKey, AssociatedBusinessUnits, ...).
|
|
1518
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1519
|
+
* @example
|
|
1520
|
+
* Platform.Load("core", "1.1.5");
|
|
1521
|
+
* var newUser = {
|
|
1522
|
+
* "Name": "Andrea Cruz",
|
|
1523
|
+
* "UserID": "acruz",
|
|
1524
|
+
* "Password": "insert new password here",
|
|
1525
|
+
* "Email": "acruz@example.com",
|
|
1526
|
+
* "ClientID": 123456789,
|
|
1527
|
+
* "DefaultBusinessUnitKey": "childBUKey",
|
|
1528
|
+
* "AssociatedBusinessUnits": ["childBUKey", "grandchildBUKey"]
|
|
1529
|
+
* };
|
|
1530
|
+
* var status = AccountUser.Add(newUser);
|
|
227
1531
|
*/
|
|
228
1532
|
function Add(properties: object): string;
|
|
229
1533
|
/**
|
|
1534
|
+
* Retrieves account users based on the specified filter criteria.
|
|
1535
|
+
*
|
|
1536
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/accountuser/)
|
|
1537
|
+
*
|
|
230
1538
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1539
|
+
* @param filter - Criteria used to search for the account user.
|
|
1540
|
+
* @returns List of results matching the filter.
|
|
1541
|
+
* @example
|
|
1542
|
+
* Platform.Load("core", "1.1.5");
|
|
1543
|
+
* var accountUser = AccountUser.Retrieve({Property:"CustomerKey",SimpleOperator:"equals",Value:"MyAccount"});
|
|
231
1544
|
*/
|
|
232
1545
|
function Retrieve(filter: object): object[];
|
|
233
1546
|
/**
|
|
1547
|
+
* Updates the account user with the supplied attributes.
|
|
1548
|
+
*
|
|
1549
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/accountuser/)
|
|
1550
|
+
*
|
|
234
1551
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1552
|
+
* @param properties - Attributes of the account user to change.
|
|
1553
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1554
|
+
* @example
|
|
1555
|
+
* Platform.Load("core", "1.1.5");
|
|
1556
|
+
* var acctUser = AccountUser.Init("myAccountUser", 123456789);
|
|
1557
|
+
* var status = acctUser.Update({ "Password": "XXXXX" });
|
|
235
1558
|
*/
|
|
236
1559
|
function Update(properties: object): string;
|
|
237
1560
|
/**
|
|
1561
|
+
* Activates the account user.
|
|
1562
|
+
*
|
|
1563
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/accountuser/)
|
|
1564
|
+
*
|
|
238
1565
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1566
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1567
|
+
* @example
|
|
1568
|
+
* Platform.Load("core", "1.1.5");
|
|
1569
|
+
* var acctUser = AccountUser.Init("myAccountUser", 123456789);
|
|
1570
|
+
* var status = acctUser.Activate();
|
|
239
1571
|
*/
|
|
240
1572
|
function Activate(): string;
|
|
241
1573
|
/**
|
|
1574
|
+
* Deactivates the account user. Note: account users cannot be deleted via server-side JavaScript — deactivation is the only "removal" path.
|
|
1575
|
+
*
|
|
1576
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/accountuser/)
|
|
1577
|
+
*
|
|
242
1578
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1579
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1580
|
+
* @example
|
|
1581
|
+
* Platform.Load("core", "1.1.5");
|
|
1582
|
+
* var acctUser = AccountUser.Init("myAccountUser", 123456789);
|
|
1583
|
+
* var status = acctUser.Deactivate();
|
|
243
1584
|
*/
|
|
244
1585
|
function Deactivate(): string;
|
|
245
1586
|
}
|
|
246
1587
|
declare namespace Portfolio {
|
|
247
1588
|
/**
|
|
1589
|
+
* Initializes a Portfolio instance bound to the specified external key. Required before invoking any other Portfolio method on the returned instance.
|
|
1590
|
+
*
|
|
1591
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/portfolio/)
|
|
1592
|
+
*
|
|
248
1593
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1594
|
+
* @param key - External key of the portfolio.
|
|
1595
|
+
* @returns An initialized Portfolio bound to the specified external key.
|
|
1596
|
+
* @example
|
|
1597
|
+
* Platform.Load("core", "1.1.5");
|
|
1598
|
+
* var portObj = Portfolio.Init("myPortfolioCK");
|
|
249
1599
|
*/
|
|
250
1600
|
function Init(key: string): any;
|
|
251
1601
|
/**
|
|
252
|
-
*
|
|
1602
|
+
* Creates a new portfolio (file) object from the supplied properties.
|
|
1603
|
+
*
|
|
1604
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/portfolio/)
|
|
1605
|
+
*
|
|
1606
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1607
|
+
* @param properties - JSON object describing the new portfolio item (DisplayName, CustomerKey, CategoryID, FileName, FileLocation).
|
|
1608
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1609
|
+
* @example
|
|
1610
|
+
* Platform.Load("core", "1.1.5");
|
|
1611
|
+
* var newPortfolio = {
|
|
1612
|
+
* DisplayName: "SSJS Portfolio Object",
|
|
1613
|
+
* CustomerKey: "myPortfolioCK",
|
|
1614
|
+
* CategoryID: 12345,
|
|
1615
|
+
* FileName: "logo.png",
|
|
1616
|
+
* FileLocation: "http://www.example.com/Portals/0/images/global/logo_main.png"
|
|
1617
|
+
* };
|
|
1618
|
+
* var status = Portfolio.Add(newPortfolio);
|
|
253
1619
|
*/
|
|
254
1620
|
function Add(properties: object): string;
|
|
255
1621
|
/**
|
|
1622
|
+
* Returns an array of portfolio objects matching the specified filter.
|
|
1623
|
+
*
|
|
1624
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/portfolio/)
|
|
1625
|
+
*
|
|
256
1626
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1627
|
+
* @param filter - Criteria used to search for portfolio objects. PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
1628
|
+
* @returns List of portfolio objects matching the filter.
|
|
1629
|
+
* @example
|
|
1630
|
+
* Platform.Load("core", "1.1.5");
|
|
1631
|
+
* var portObjArr = Portfolio.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "PortfolioObjectKey" });
|
|
257
1632
|
*/
|
|
258
1633
|
function Retrieve(filter: object): object[];
|
|
259
1634
|
/**
|
|
1635
|
+
* Updates the portfolio object with the supplied attributes.
|
|
1636
|
+
*
|
|
1637
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/portfolio/)
|
|
1638
|
+
*
|
|
260
1639
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1640
|
+
* @param properties - Attributes to change on the portfolio object.
|
|
1641
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1642
|
+
* @example
|
|
1643
|
+
* Platform.Load("core", "1.1.5");
|
|
1644
|
+
* var portObj = Portfolio.Init("myPortfolioCK");
|
|
1645
|
+
* var status = portObj.Update({ DisplayName: "Updated SSJS Image" });
|
|
261
1646
|
*/
|
|
262
1647
|
function Update(properties: object): string;
|
|
263
1648
|
/**
|
|
1649
|
+
* Removes the previously initialized portfolio object.
|
|
1650
|
+
*
|
|
1651
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/portfolio/)
|
|
1652
|
+
*
|
|
264
1653
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1654
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1655
|
+
* @example
|
|
1656
|
+
* Platform.Load("core", "1.1.5");
|
|
1657
|
+
* var portObj = Portfolio.Init("myPortfolioCK");
|
|
1658
|
+
* var status = portObj.Remove();
|
|
265
1659
|
*/
|
|
266
1660
|
function Remove(): string;
|
|
267
1661
|
}
|
|
268
1662
|
declare namespace ContentAreaObj {
|
|
269
1663
|
/**
|
|
1664
|
+
* Initializes a ContentAreaObj instance bound to the specified external key. DEPRECATED — Content Areas have been deprecated; new content areas cannot be created or updated. Existing content areas remain readable on older accounts only.
|
|
1665
|
+
*
|
|
1666
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/contentareaobj/)
|
|
1667
|
+
*
|
|
270
1668
|
* @deprecated
|
|
271
1669
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1670
|
+
* @param key - External key of the content area.
|
|
1671
|
+
* @returns An initialized ContentAreaObj bound to the specified external key.
|
|
1672
|
+
* @example
|
|
1673
|
+
* Platform.Load("core", "1.1.5");
|
|
1674
|
+
* var area = ContentAreaObj.Init("myCA");
|
|
272
1675
|
*/
|
|
273
1676
|
function Init(key: string): any;
|
|
274
1677
|
/**
|
|
1678
|
+
* Creates a new content area from the supplied properties. DEPRECATED — calls fail on accounts where the Content Areas feature has been retired.
|
|
1679
|
+
*
|
|
1680
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/contentareaobj/)
|
|
1681
|
+
*
|
|
275
1682
|
* @deprecated
|
|
276
1683
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1684
|
+
* @param properties - JSON object describing the new content area (CustomerKey, Name, CategoryID, Layout, LayoutSpecified, Content).
|
|
1685
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1686
|
+
* @example
|
|
1687
|
+
* Platform.Load("core", "1.1.5");
|
|
1688
|
+
* var exampleArea = {
|
|
1689
|
+
* CustomerKey: "exampleArea",
|
|
1690
|
+
* Name: "SSJS Content Area Example",
|
|
1691
|
+
* CategoryID: 123456,
|
|
1692
|
+
* Layout: "RawText",
|
|
1693
|
+
* LayoutSpecified: true,
|
|
1694
|
+
* Content: "<b>This is example content</b>"
|
|
1695
|
+
* };
|
|
1696
|
+
* var status = ContentAreaObj.Add(exampleArea);
|
|
277
1697
|
*/
|
|
278
1698
|
function Add(properties: object): string;
|
|
279
1699
|
/**
|
|
1700
|
+
* Returns an array of content areas matching the specified filter. DEPRECATED — read-only access only; the Content Areas feature has been retired for new content.
|
|
1701
|
+
*
|
|
1702
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/contentareaobj/)
|
|
1703
|
+
*
|
|
280
1704
|
* @deprecated
|
|
281
1705
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1706
|
+
* @param filter - PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
1707
|
+
* @returns List of content areas matching the filter.
|
|
1708
|
+
* @example
|
|
1709
|
+
* Platform.Load("core", "1.1.5");
|
|
1710
|
+
* var results = ContentAreaObj.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "myCA" });
|
|
282
1711
|
*/
|
|
283
1712
|
function Retrieve(filter: object): object[];
|
|
284
1713
|
/**
|
|
1714
|
+
* Updates the content area with the supplied attributes. DEPRECATED — calls fail on accounts where the Content Areas feature has been retired.
|
|
1715
|
+
*
|
|
1716
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/contentareaobj/)
|
|
1717
|
+
*
|
|
285
1718
|
* @deprecated
|
|
286
1719
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1720
|
+
* @param properties - Attributes to change on the content area.
|
|
1721
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1722
|
+
* @example
|
|
1723
|
+
* Platform.Load("core", "1.1.5");
|
|
1724
|
+
* var obj = ContentAreaObj.Init("myCA");
|
|
1725
|
+
* var status = obj.Update({ Name: "Name Updated By SSJS" });
|
|
287
1726
|
*/
|
|
288
1727
|
function Update(properties: object): string;
|
|
289
1728
|
/**
|
|
1729
|
+
* Removes the previously initialized content area. DEPRECATED — calls fail on accounts where the Content Areas feature has been retired.
|
|
1730
|
+
*
|
|
1731
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/contentareaobj/)
|
|
1732
|
+
*
|
|
290
1733
|
* @deprecated
|
|
291
1734
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1735
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1736
|
+
* @example
|
|
1737
|
+
* Platform.Load("core", "1.1.5");
|
|
1738
|
+
* var obj = ContentAreaObj.Init("myCA");
|
|
1739
|
+
* var status = obj.Remove();
|
|
292
1740
|
*/
|
|
293
1741
|
function Remove(): string;
|
|
294
1742
|
}
|
|
295
1743
|
declare namespace Folder {
|
|
296
1744
|
/**
|
|
1745
|
+
* Initializes a Folder instance, optionally bound to the specified external key. When called without arguments, a subsequent `<FolderInstance>.SetID(id)` call is required to bind the instance to a specific folder.
|
|
1746
|
+
*
|
|
1747
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/folder/)
|
|
1748
|
+
*
|
|
297
1749
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1750
|
+
* @param key - External key of the folder. Optional — pass nothing and use `SetID()` when the folder has no external key.
|
|
1751
|
+
* @returns An initialized Folder; bound to the specified external key when one is supplied.
|
|
1752
|
+
* @example
|
|
1753
|
+
* Platform.Load("core", "1");
|
|
1754
|
+
* var myFolder = Folder.Init("myFolder");
|
|
1755
|
+
* // or, when the folder has no external key:
|
|
1756
|
+
* var myIDFolder = Folder.Init();
|
|
1757
|
+
* myIDFolder.SetID(12345);
|
|
298
1758
|
*/
|
|
299
1759
|
function Init(key?: string): any;
|
|
300
1760
|
/**
|
|
301
|
-
*
|
|
1761
|
+
* Creates a new folder as a child of an existing folder.
|
|
1762
|
+
*
|
|
1763
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/folder/)
|
|
1764
|
+
*
|
|
1765
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1766
|
+
* @param properties - JSON object describing the new folder (Name, CustomerKey, Description, ContentType, IsActive, IsEditable, AllowChildren, ParentFolderID).
|
|
1767
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1768
|
+
* @example
|
|
1769
|
+
* Platform.Load("core", "1.1.5");
|
|
1770
|
+
* var newFolder = {
|
|
1771
|
+
* Name: "Test Add Folder",
|
|
1772
|
+
* CustomerKey: "test_folder_key",
|
|
1773
|
+
* Description: "Test added",
|
|
1774
|
+
* ContentType: "email",
|
|
1775
|
+
* IsActive: "true",
|
|
1776
|
+
* IsEditable: "true",
|
|
1777
|
+
* AllowChildren: "false",
|
|
1778
|
+
* ParentFolderID: 123456
|
|
1779
|
+
* };
|
|
1780
|
+
* var status = Folder.Add(newFolder);
|
|
302
1781
|
*/
|
|
303
1782
|
function Add(properties: object): string;
|
|
304
1783
|
/**
|
|
305
|
-
*
|
|
1784
|
+
* Returns an array of folders matching the specified filter. Supports simple `{Property, SimpleOperator, Value}` filters and complex filters with `LeftOperand`, `LogicalOperator`, `RightOperand`. Use dot notation (e.g. `ParentFolder.Name`) to filter on child fields.
|
|
1785
|
+
*
|
|
1786
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/folder/)
|
|
1787
|
+
*
|
|
1788
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1789
|
+
* @param filter - WSProxy-style filter object — simple or compound with `AND`/`OR`.
|
|
1790
|
+
* @returns Array of folder objects (including nested `ParentFolder` info).
|
|
1791
|
+
* @example
|
|
1792
|
+
* Platform.Load("core", "1");
|
|
1793
|
+
* var folders = Folder.Retrieve({
|
|
1794
|
+
* Property: "ParentFolder.Name",
|
|
1795
|
+
* SimpleOperator: "equals",
|
|
1796
|
+
* Value: "RewardsProgram"
|
|
1797
|
+
* });
|
|
1798
|
+
* Write(Stringify(folders));
|
|
306
1799
|
*/
|
|
307
1800
|
function Retrieve(filter: object): object[];
|
|
308
1801
|
/**
|
|
1802
|
+
* Updates the folder with the supplied attributes.
|
|
1803
|
+
*
|
|
1804
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/folder/)
|
|
1805
|
+
*
|
|
309
1806
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1807
|
+
* @param properties - Attributes to change on the folder.
|
|
1808
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1809
|
+
* @example
|
|
1810
|
+
* Platform.Load("core", "1.1.5");
|
|
1811
|
+
* var myFolder = Folder.Init("myFolder");
|
|
1812
|
+
* var status = myFolder.Update({ Name: "Updated Folder Name" });
|
|
310
1813
|
*/
|
|
311
1814
|
function Update(properties: object): string;
|
|
312
1815
|
/**
|
|
1816
|
+
* Removes the previously initialized folder.
|
|
1817
|
+
*
|
|
1818
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/folder/)
|
|
1819
|
+
*
|
|
313
1820
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1821
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1822
|
+
* @example
|
|
1823
|
+
* Platform.Load("core", "1.1.5");
|
|
1824
|
+
* var myFolder = Folder.Init("myFolder");
|
|
1825
|
+
* myFolder.Remove();
|
|
314
1826
|
*/
|
|
315
1827
|
function Remove(): string;
|
|
316
1828
|
/**
|
|
1829
|
+
* Binds a previously initialized Folder instance to a specific folder ID. Use this when the folder has no external key, after calling `Folder.Init()` without arguments.
|
|
1830
|
+
*
|
|
1831
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/folder/)
|
|
1832
|
+
*
|
|
317
1833
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1834
|
+
* @param id - The folder ID to bind to this Folder instance.
|
|
1835
|
+
* @returns No return value.
|
|
1836
|
+
* @example
|
|
1837
|
+
* Platform.Load("core", "1.1.5");
|
|
1838
|
+
* var myIDFolder = Folder.Init();
|
|
1839
|
+
* myIDFolder.SetID(12345);
|
|
318
1840
|
*/
|
|
319
1841
|
function SetID(id: number): void;
|
|
320
1842
|
}
|
|
321
1843
|
declare namespace Template {
|
|
322
1844
|
/**
|
|
1845
|
+
* Initializes a Template instance bound to the specified external key. Required before invoking any other Template method on the returned instance.
|
|
1846
|
+
*
|
|
1847
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/template/)
|
|
1848
|
+
*
|
|
323
1849
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1850
|
+
* @param key - External key of the template.
|
|
1851
|
+
* @returns An initialized Template bound to the specified external key.
|
|
1852
|
+
* @example
|
|
1853
|
+
* Platform.Load("core", "1");
|
|
1854
|
+
* var t = Template.Init("myTemplate");
|
|
324
1855
|
*/
|
|
325
1856
|
function Init(key: string): any;
|
|
326
1857
|
/**
|
|
327
|
-
*
|
|
1858
|
+
* Creates a new template from the supplied properties.
|
|
1859
|
+
*
|
|
1860
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/template/)
|
|
1861
|
+
*
|
|
1862
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1863
|
+
* @param properties - JSON object describing the new template (CustomerKey, TemplateName, LayoutHTML).
|
|
1864
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1865
|
+
* @example
|
|
1866
|
+
* Platform.Load("core", "1");
|
|
1867
|
+
* var myTemp = {
|
|
1868
|
+
* CustomerKey: "test_template",
|
|
1869
|
+
* TemplateName: "SSJS Test Template",
|
|
1870
|
+
* LayoutHTML: "this is some HTML"
|
|
1871
|
+
* };
|
|
1872
|
+
* var status = Template.Add(myTemp);
|
|
328
1873
|
*/
|
|
329
1874
|
function Add(properties: object): string;
|
|
330
1875
|
/**
|
|
1876
|
+
* Returns an array of templates matching the specified filter. Pass `{ Filter: { Property, SimpleOperator, Value }, QueryAllAccounts: true }` to query across all accessible accounts.
|
|
1877
|
+
*
|
|
1878
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/template/)
|
|
1879
|
+
*
|
|
331
1880
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1881
|
+
* @param filter - PascalCase WSProxy-style filter object, optionally wrapped with `QueryAllAccounts: true`.
|
|
1882
|
+
* @returns List of templates matching the filter.
|
|
1883
|
+
* @example
|
|
1884
|
+
* Platform.Load("core", "1.1.5");
|
|
1885
|
+
* var getTemplate = Template.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "MyTemplate" });
|
|
332
1886
|
*/
|
|
333
1887
|
function Retrieve(filter: object): object[];
|
|
334
1888
|
/**
|
|
1889
|
+
* Updates the template with the supplied attributes.
|
|
1890
|
+
*
|
|
1891
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/template/)
|
|
1892
|
+
*
|
|
335
1893
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1894
|
+
* @param properties - Attributes to change on the template.
|
|
1895
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1896
|
+
* @example
|
|
1897
|
+
* Platform.Load("core", "1.1.5");
|
|
1898
|
+
* var myTemplate = Template.Init("myTemplateCK");
|
|
1899
|
+
* var status = myTemplate.Update({ TemplateName: "Edited Template" });
|
|
336
1900
|
*/
|
|
337
1901
|
function Update(properties: object): string;
|
|
338
1902
|
}
|
|
339
1903
|
declare namespace DeliveryProfile {
|
|
340
1904
|
/**
|
|
1905
|
+
* Initializes a DeliveryProfile instance bound to the specified external key. Required before invoking any other DeliveryProfile method on the returned instance.
|
|
1906
|
+
*
|
|
1907
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/deliveryprofile/)
|
|
1908
|
+
*
|
|
341
1909
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1910
|
+
* @param key - External key of the delivery profile.
|
|
1911
|
+
* @returns An initialized DeliveryProfile bound to the specified external key.
|
|
1912
|
+
* @example
|
|
1913
|
+
* Platform.Load("core", "1");
|
|
1914
|
+
* var myProfile = DeliveryProfile.Init("myDeliveryProfile");
|
|
342
1915
|
*/
|
|
343
1916
|
function Init(key: string): any;
|
|
344
1917
|
/**
|
|
345
|
-
*
|
|
1918
|
+
* Creates a new delivery profile from the supplied properties.
|
|
1919
|
+
*
|
|
1920
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/deliveryprofile/)
|
|
1921
|
+
*
|
|
1922
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1923
|
+
* @param properties - JSON object describing the new delivery profile (Name, CustomerKey, Description, SourceAddressType, ...).
|
|
1924
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1925
|
+
* @example
|
|
1926
|
+
* Platform.Load("core", "1.1.5");
|
|
1927
|
+
* var newDP = {
|
|
1928
|
+
* Name: "SSJS Added Delivery Profile",
|
|
1929
|
+
* CustomerKey: "test_delivery_profile",
|
|
1930
|
+
* Description: "An SSJS Added Profile",
|
|
1931
|
+
* SourceAddressType: "DefaultPrivateIPAddress"
|
|
1932
|
+
* };
|
|
1933
|
+
* var status = DeliveryProfile.Add(newDP);
|
|
346
1934
|
*/
|
|
347
1935
|
function Add(properties: object): string;
|
|
348
1936
|
/**
|
|
1937
|
+
* Updates the delivery profile with the supplied attributes.
|
|
1938
|
+
*
|
|
1939
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/deliveryprofile/)
|
|
1940
|
+
*
|
|
349
1941
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1942
|
+
* @param properties - Attributes to change on the delivery profile.
|
|
1943
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1944
|
+
* @example
|
|
1945
|
+
* Platform.Load("core", "1.1.5");
|
|
1946
|
+
* var myProfile = DeliveryProfile.Init("myDeliveryProfile");
|
|
1947
|
+
* var status = myProfile.Update({ Name: "SSJS Updated Delivery Profile" });
|
|
350
1948
|
*/
|
|
351
1949
|
function Update(properties: object): string;
|
|
352
1950
|
/**
|
|
1951
|
+
* Removes the previously initialized delivery profile.
|
|
1952
|
+
*
|
|
1953
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/deliveryprofile/)
|
|
1954
|
+
*
|
|
353
1955
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1956
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1957
|
+
* @example
|
|
1958
|
+
* Platform.Load("core", "1.1.5");
|
|
1959
|
+
* var myProfile = DeliveryProfile.Init("myDeliveryProfile");
|
|
1960
|
+
* var status = myProfile.Remove();
|
|
354
1961
|
*/
|
|
355
1962
|
function Remove(): string;
|
|
356
1963
|
}
|
|
357
1964
|
declare namespace SenderProfile {
|
|
358
1965
|
/**
|
|
1966
|
+
* Initializes a SenderProfile instance bound to the specified external key. Note: SenderProfile methods only work on landing pages — they cannot run inside email messages at send time.
|
|
1967
|
+
*
|
|
1968
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senderprofile/)
|
|
1969
|
+
*
|
|
359
1970
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1971
|
+
* @param key - External key of the sender profile.
|
|
1972
|
+
* @returns An initialized SenderProfile bound to the specified external key.
|
|
1973
|
+
* @example
|
|
1974
|
+
* Platform.Load("core", "1");
|
|
1975
|
+
* var myProfile = SenderProfile.Init("mySenderProfile");
|
|
360
1976
|
*/
|
|
361
1977
|
function Init(key: string): any;
|
|
362
1978
|
/**
|
|
363
|
-
*
|
|
1979
|
+
* Creates a new sender profile from the supplied properties.
|
|
1980
|
+
*
|
|
1981
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senderprofile/)
|
|
1982
|
+
*
|
|
1983
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1984
|
+
* @param properties - JSON object describing the new sender profile (Name, CustomerKey, Description, FromName, FromAddress, ...).
|
|
1985
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1986
|
+
* @example
|
|
1987
|
+
* Platform.Load("core", "1.1.5");
|
|
1988
|
+
* var newSP = {
|
|
1989
|
+
* Name: "SSJS Added Send Profile",
|
|
1990
|
+
* CustomerKey: "test_send_profile",
|
|
1991
|
+
* Description: "An SSJS Added Profile",
|
|
1992
|
+
* FromName: "Andrea Cruz",
|
|
1993
|
+
* FromAddress: "acruz@example.com"
|
|
1994
|
+
* };
|
|
1995
|
+
* var status = SenderProfile.Add(newSP);
|
|
364
1996
|
*/
|
|
365
1997
|
function Add(properties: object): string;
|
|
366
1998
|
/**
|
|
1999
|
+
* Updates the sender profile with the supplied attributes.
|
|
2000
|
+
*
|
|
2001
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senderprofile/)
|
|
2002
|
+
*
|
|
367
2003
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2004
|
+
* @param properties - Attributes to change on the sender profile.
|
|
2005
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2006
|
+
* @example
|
|
2007
|
+
* Platform.Load("core", "1.1.5");
|
|
2008
|
+
* var myProfile = SenderProfile.Init("mySenderProfile");
|
|
2009
|
+
* var status = myProfile.Update({ Name: "SSJS Updated Sender Profile" });
|
|
368
2010
|
*/
|
|
369
2011
|
function Update(properties: object): string;
|
|
370
2012
|
/**
|
|
2013
|
+
* Removes the previously initialized sender profile.
|
|
2014
|
+
*
|
|
2015
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senderprofile/)
|
|
2016
|
+
*
|
|
371
2017
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2018
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2019
|
+
* @example
|
|
2020
|
+
* Platform.Load("core", "1.1.5");
|
|
2021
|
+
* var myProfile = SenderProfile.Init("mySenderProfile");
|
|
2022
|
+
* var status = myProfile.Remove();
|
|
372
2023
|
*/
|
|
373
2024
|
function Remove(): string;
|
|
374
2025
|
}
|
|
375
2026
|
declare namespace SendClassification {
|
|
376
2027
|
/**
|
|
2028
|
+
* Initializes a SendClassification instance bound to the specified external key. Required before invoking any other SendClassification method on the returned instance.
|
|
2029
|
+
*
|
|
2030
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/sendclassification/)
|
|
2031
|
+
*
|
|
377
2032
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2033
|
+
* @param key - External key of the send classification.
|
|
2034
|
+
* @returns An initialized SendClassification bound to the specified external key.
|
|
2035
|
+
* @example
|
|
2036
|
+
* Platform.Load("core", "1");
|
|
2037
|
+
* var sc = SendClassification.Init("mySendClassification");
|
|
378
2038
|
*/
|
|
379
2039
|
function Init(key: string): any;
|
|
380
2040
|
/**
|
|
381
|
-
*
|
|
2041
|
+
* Creates a new send classification from the supplied properties.
|
|
2042
|
+
*
|
|
2043
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/sendclassification/)
|
|
2044
|
+
*
|
|
2045
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2046
|
+
* @param properties - JSON object describing the new send classification (CustomerKey, Name, Description, SenderProfileKey, DeliveryProfileKey).
|
|
2047
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2048
|
+
* @example
|
|
2049
|
+
* Platform.Load("core", "1.1.5");
|
|
2050
|
+
* var newSC = {
|
|
2051
|
+
* CustomerKey: "mySCKey",
|
|
2052
|
+
* Name: "SSJS Test SC",
|
|
2053
|
+
* Description: "Test SSJS description",
|
|
2054
|
+
* SenderProfileKey: "mySPKey",
|
|
2055
|
+
* DeliveryProfileKey: "myDPKey"
|
|
2056
|
+
* };
|
|
2057
|
+
* SendClassification.Add(newSC);
|
|
382
2058
|
*/
|
|
383
2059
|
function Add(properties: object): string;
|
|
384
2060
|
/**
|
|
2061
|
+
* Returns an array of send classifications matching the specified filter.
|
|
2062
|
+
*
|
|
2063
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/sendclassification/)
|
|
2064
|
+
*
|
|
385
2065
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2066
|
+
* @param filter - PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
2067
|
+
* @returns List of send classifications matching the filter.
|
|
2068
|
+
* @example
|
|
2069
|
+
* Platform.Load("core", "1.1.5");
|
|
2070
|
+
* var results = SendClassification.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "mySendClassification" });
|
|
386
2071
|
*/
|
|
387
2072
|
function Retrieve(filter: object): object[];
|
|
388
2073
|
/**
|
|
389
|
-
*
|
|
2074
|
+
* Updates the send classification with the supplied attributes. You must include both `SenderProfileKey` and `DeliveryProfileKey` in `properties` for the update to succeed.
|
|
2075
|
+
*
|
|
2076
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/sendclassification/)
|
|
2077
|
+
*
|
|
2078
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2079
|
+
* @param properties - Attributes to change. Must include `SenderProfileKey` and `DeliveryProfileKey`.
|
|
2080
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2081
|
+
* @example
|
|
2082
|
+
* Platform.Load("core", "1.1.5");
|
|
2083
|
+
* var sc = SendClassification.Init("mySendClassification");
|
|
2084
|
+
* var updatedSC = {
|
|
2085
|
+
* Name: "Updated Send Classification",
|
|
2086
|
+
* SenderProfileKey: "mySPKey",
|
|
2087
|
+
* DeliveryProfileKey: "myDPKey"
|
|
2088
|
+
* };
|
|
2089
|
+
* var status = sc.Update(updatedSC);
|
|
390
2090
|
*/
|
|
391
2091
|
function Update(properties: object): string;
|
|
392
2092
|
/**
|
|
2093
|
+
* Removes the previously initialized send classification.
|
|
2094
|
+
*
|
|
2095
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/sendclassification/)
|
|
2096
|
+
*
|
|
393
2097
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2098
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2099
|
+
* @example
|
|
2100
|
+
* Platform.Load("core", "1.1.5");
|
|
2101
|
+
* var sc = SendClassification.Init("mySendClassification");
|
|
2102
|
+
* var status = sc.Remove();
|
|
394
2103
|
*/
|
|
395
2104
|
function Remove(): string;
|
|
396
2105
|
}
|
|
397
2106
|
declare namespace FilterDefinition {
|
|
398
2107
|
/**
|
|
2108
|
+
* Initializes a FilterDefinition instance bound to the specified external key. Required before invoking any other FilterDefinition method on the returned instance.
|
|
2109
|
+
*
|
|
2110
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/filterdefinition/)
|
|
2111
|
+
*
|
|
399
2112
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2113
|
+
* @param key - External key of the filter definition.
|
|
2114
|
+
* @returns An initialized FilterDefinition bound to the specified external key.
|
|
2115
|
+
* @example
|
|
2116
|
+
* Platform.Load("core", "1");
|
|
2117
|
+
* var fd = FilterDefinition.Init("myFilterDef");
|
|
400
2118
|
*/
|
|
401
2119
|
function Init(key: string): any;
|
|
402
2120
|
/**
|
|
403
|
-
*
|
|
2121
|
+
* Creates a new filter definition from the supplied properties. The `Filter` field accepts either a simple `{Property, SimpleOperator, Value}` filter or a complex filter with `LeftOperand`, `LogicalOperator`, `RightOperand`. `DataSource.Type` must be `"SubscriberList"` or `"DataExtension"`.
|
|
2122
|
+
*
|
|
2123
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/filterdefinition/)
|
|
2124
|
+
*
|
|
2125
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2126
|
+
* @param properties - JSON object describing the new filter definition (Name, CustomerKey, Filter, DataSource).
|
|
2127
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2128
|
+
* @example
|
|
2129
|
+
* Platform.Load("core", "1.1.5");
|
|
2130
|
+
* var filterObj = { Property: "LuckyNumber", SimpleOperator: "equals", Value: 77 };
|
|
2131
|
+
* var newFD = {
|
|
2132
|
+
* Name: "SSJS Filter Definition",
|
|
2133
|
+
* CustomerKey: "myFilterDef",
|
|
2134
|
+
* Filter: filterObj,
|
|
2135
|
+
* DataSource: { Type: "SubscriberList", CustomerKey: "example_list_key" }
|
|
2136
|
+
* };
|
|
2137
|
+
* var status = FilterDefinition.Add(newFD);
|
|
404
2138
|
*/
|
|
405
2139
|
function Add(properties: object): string;
|
|
406
2140
|
/**
|
|
2141
|
+
* Returns an array of filter definitions matching the specified filter.
|
|
2142
|
+
*
|
|
2143
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/filterdefinition/)
|
|
2144
|
+
*
|
|
407
2145
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2146
|
+
* @param filter - PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
2147
|
+
* @returns List of filter definitions matching the filter.
|
|
2148
|
+
* @example
|
|
2149
|
+
* Platform.Load("core", "1.1.5");
|
|
2150
|
+
* var results = FilterDefinition.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "myFilterDef" });
|
|
408
2151
|
*/
|
|
409
2152
|
function Retrieve(filter: object): object[];
|
|
410
2153
|
/**
|
|
2154
|
+
* Updates the filter definition with the supplied attributes.
|
|
2155
|
+
*
|
|
2156
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/filterdefinition/)
|
|
2157
|
+
*
|
|
411
2158
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2159
|
+
* @param properties - Attributes to change on the filter definition.
|
|
2160
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2161
|
+
* @example
|
|
2162
|
+
* Platform.Load("core", "1.1.5");
|
|
2163
|
+
* var fd = FilterDefinition.Init("myFilterDef");
|
|
2164
|
+
* var status = fd.Update({ Name: "Updated Name" });
|
|
412
2165
|
*/
|
|
413
2166
|
function Update(properties: object): string;
|
|
414
2167
|
/**
|
|
2168
|
+
* Deletes the previously initialized filter definition.
|
|
2169
|
+
*
|
|
2170
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/filterdefinition/)
|
|
2171
|
+
*
|
|
415
2172
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2173
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2174
|
+
* @example
|
|
2175
|
+
* Platform.Load("core", "1.1.5");
|
|
2176
|
+
* var myFD = FilterDefinition.Init("myFilterDef");
|
|
2177
|
+
* myFD.Remove();
|
|
416
2178
|
*/
|
|
417
2179
|
function Remove(): string;
|
|
418
2180
|
}
|
|
419
2181
|
declare namespace QueryDefinition {
|
|
420
2182
|
/**
|
|
2183
|
+
* Initializes a QueryDefinition instance bound to the specified external key. Required before invoking any other QueryDefinition method on the returned instance.
|
|
2184
|
+
*
|
|
2185
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/querydefinition/)
|
|
2186
|
+
*
|
|
421
2187
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2188
|
+
* @param key - External key of the query definition.
|
|
2189
|
+
* @returns An initialized QueryDefinition bound to the specified external key.
|
|
2190
|
+
* @example
|
|
2191
|
+
* Platform.Load("core", "1");
|
|
2192
|
+
* var qd = QueryDefinition.Init("myQueryDef");
|
|
422
2193
|
*/
|
|
423
2194
|
function Init(key: string): any;
|
|
424
2195
|
/**
|
|
425
|
-
*
|
|
2196
|
+
* Creates a new query definition from the supplied properties. Pass an optional `CategoryID` to place the query inside a specific folder.
|
|
2197
|
+
*
|
|
2198
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/querydefinition/)
|
|
2199
|
+
*
|
|
2200
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2201
|
+
* @param properties - JSON object describing the new query definition (Name, CustomerKey, optional CategoryID, TargetUpdateType, TargetType, Target, QueryText).
|
|
2202
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2203
|
+
* @example
|
|
2204
|
+
* Platform.Load("core", "1.1.5");
|
|
2205
|
+
* var queryDef = {
|
|
2206
|
+
* Name: "Example Query Definition",
|
|
2207
|
+
* CustomerKey: "myQueryDef",
|
|
2208
|
+
* TargetUpdateType: "Overwrite",
|
|
2209
|
+
* TargetType: "DE",
|
|
2210
|
+
* Target: { Name: "Example Target DE", CustomerKey: "example_target_de" },
|
|
2211
|
+
* QueryText: "SELECT SubKey, Email, Name FROM [Example Target DE] where FavoriteItemID=77"
|
|
2212
|
+
* };
|
|
2213
|
+
* var status = QueryDefinition.Add(queryDef);
|
|
426
2214
|
*/
|
|
427
2215
|
function Add(properties: object): string;
|
|
428
2216
|
/**
|
|
429
|
-
*
|
|
2217
|
+
* Returns an array of query definitions matching the specified filter. Supports simple `{Property, SimpleOperator, Value}` filters and complex filters with `LeftOperand`, `LogicalOperator`, `RightOperand`.
|
|
2218
|
+
*
|
|
2219
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/querydefinition/)
|
|
2220
|
+
*
|
|
2221
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2222
|
+
* @param filter - WSProxy-style filter object — simple or compound with `AND`/`OR`.
|
|
2223
|
+
* @returns Array of query definition objects (with nested `DataExtensionTarget` info when applicable).
|
|
2224
|
+
* @example
|
|
2225
|
+
* Platform.Load("Core", "1");
|
|
2226
|
+
* var result = QueryDefinition.Retrieve({
|
|
2227
|
+
* Property: "Status",
|
|
2228
|
+
* SimpleOperator: "equals",
|
|
2229
|
+
* Value: "Active"
|
|
2230
|
+
* });
|
|
2231
|
+
* Write(Stringify(result));
|
|
430
2232
|
*/
|
|
431
2233
|
function Retrieve(filter: object): object[];
|
|
432
2234
|
/**
|
|
433
|
-
*
|
|
2235
|
+
* Updates the query definition with the supplied attributes.
|
|
2236
|
+
*
|
|
2237
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/querydefinition/)
|
|
2238
|
+
*
|
|
2239
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2240
|
+
* @param properties - Attributes to change on the query definition.
|
|
2241
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2242
|
+
* @example
|
|
2243
|
+
* Platform.Load("core", "1.1.5");
|
|
2244
|
+
* var qd = QueryDefinition.Init("myQueryDef");
|
|
2245
|
+
* var status = qd.Update({
|
|
2246
|
+
* Name: "Updated Query Definition Name",
|
|
2247
|
+
* QueryText: "SELECT SubKey, Email, Name FROM [Example Target DE] where FavoriteItemID=12"
|
|
2248
|
+
* });
|
|
434
2249
|
*/
|
|
435
2250
|
function Update(properties: object): string;
|
|
436
2251
|
/**
|
|
2252
|
+
* Removes the previously initialized query definition.
|
|
2253
|
+
*
|
|
2254
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/querydefinition/)
|
|
2255
|
+
*
|
|
437
2256
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2257
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2258
|
+
* @example
|
|
2259
|
+
* Platform.Load("core", "1.1.5");
|
|
2260
|
+
* var qd = QueryDefinition.Init("myQueryDef");
|
|
2261
|
+
* var status = qd.Remove();
|
|
438
2262
|
*/
|
|
439
2263
|
function Remove(): string;
|
|
440
2264
|
/**
|
|
2265
|
+
* Executes the query definition. Runs the SQL and writes results into the configured target Data Extension.
|
|
2266
|
+
*
|
|
2267
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/querydefinition/)
|
|
2268
|
+
*
|
|
441
2269
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2270
|
+
* @param action - The action to perform. Use `"start"` to execute the query.
|
|
2271
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2272
|
+
* @example
|
|
2273
|
+
* Platform.Load("core", "1");
|
|
2274
|
+
* var qd = QueryDefinition.Init("MY_QUERY_KEY");
|
|
2275
|
+
* var result = qd.Perform("start");
|
|
2276
|
+
* Write(Stringify(result));
|
|
442
2277
|
*/
|
|
443
2278
|
function Perform(action: string): string;
|
|
444
2279
|
}
|
|
445
2280
|
declare namespace List {
|
|
446
2281
|
/**
|
|
2282
|
+
* Initializes a List instance bound to the specified external key. Required before invoking any other List method on the returned instance.
|
|
2283
|
+
*
|
|
2284
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list/)
|
|
2285
|
+
*
|
|
447
2286
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2287
|
+
* @param key - External key of the list.
|
|
2288
|
+
* @returns An initialized List bound to the specified external key.
|
|
2289
|
+
* @example
|
|
2290
|
+
* Platform.Load("core", "1");
|
|
2291
|
+
* var myList = List.Init("myList");
|
|
448
2292
|
*/
|
|
449
2293
|
function Init(key: string): any;
|
|
450
2294
|
/**
|
|
2295
|
+
* Creates a new list from the supplied properties and returns an initialized list instance. Note: unlike most static `Add` methods, this returns a `ListInstance`, not `"OK"`.
|
|
2296
|
+
*
|
|
2297
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list/)
|
|
2298
|
+
*
|
|
451
2299
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2300
|
+
* @param properties - JSON object describing the new list (CustomerKey, Name, Description, ...).
|
|
2301
|
+
* @returns An initialized List bound to the newly-created list.
|
|
2302
|
+
* @example
|
|
2303
|
+
* Platform.Load("core", "1.1.5");
|
|
2304
|
+
* var myNewList = List.Add({ CustomerKey: "libList", Name: "testLib", Description: "desc" });
|
|
452
2305
|
*/
|
|
453
2306
|
function Add(properties: object): any;
|
|
454
2307
|
/**
|
|
2308
|
+
* Returns an array of lists matching the specified filter.
|
|
2309
|
+
*
|
|
2310
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list/)
|
|
2311
|
+
*
|
|
455
2312
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2313
|
+
* @param filter - PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
2314
|
+
* @returns List of list objects matching the filter.
|
|
2315
|
+
* @example
|
|
2316
|
+
* Platform.Load("core", "1.1.5");
|
|
2317
|
+
* var lists = List.Retrieve({ Property: "ListName", SimpleOperator: "equals", Value: "BirthdayList" });
|
|
456
2318
|
*/
|
|
457
2319
|
function Retrieve(filter: object): object[];
|
|
458
2320
|
/**
|
|
2321
|
+
* Removes the previously initialized list.
|
|
2322
|
+
*
|
|
2323
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list/)
|
|
2324
|
+
*
|
|
459
2325
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2326
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2327
|
+
* @example
|
|
2328
|
+
* Platform.Load("core", "1.1.5");
|
|
2329
|
+
* var myList = List.Init("myList");
|
|
2330
|
+
* var status = myList.Remove();
|
|
460
2331
|
*/
|
|
461
2332
|
function Remove(): string;
|
|
462
2333
|
}
|
|
463
2334
|
declare namespace List.Subscribers {
|
|
464
2335
|
/**
|
|
465
|
-
*
|
|
2336
|
+
* Adds a subscriber to the previously initialized list.
|
|
2337
|
+
*
|
|
2338
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
|
|
2339
|
+
*
|
|
2340
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2341
|
+
* @param properties - Object containing subscriber properties (EmailAddress, SubscriberKey, optionally list status).
|
|
2342
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2343
|
+
* @example
|
|
2344
|
+
* Platform.Load("core", "1");
|
|
2345
|
+
* var list = List.Init("MY_LIST_KEY");
|
|
2346
|
+
* var result = list.Subscribers.Add({
|
|
2347
|
+
* EmailAddress: "test@example.com",
|
|
2348
|
+
* SubscriberKey: "test@example.com"
|
|
2349
|
+
* });
|
|
2350
|
+
* Write(Stringify(result));
|
|
466
2351
|
*/
|
|
467
2352
|
function Add(properties: object): string;
|
|
468
2353
|
/**
|
|
2354
|
+
* Returns the subscribers belonging to the previously initialized list. Pass an optional filter to narrow the results; omit it to return all subscribers on the list.
|
|
2355
|
+
*
|
|
2356
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
|
|
2357
|
+
*
|
|
469
2358
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2359
|
+
* @param filter - Optional WSProxy-style filter object to narrow the results.
|
|
2360
|
+
* @returns List of subscriber objects on the list (filtered when a filter is supplied).
|
|
2361
|
+
* @example
|
|
2362
|
+
* Platform.Load("core", "1");
|
|
2363
|
+
* var list = List.Init("MY_LIST_KEY");
|
|
2364
|
+
* var subscribers = list.Subscribers.Retrieve();
|
|
470
2365
|
*/
|
|
471
2366
|
function Retrieve(filter?: object): object[];
|
|
472
2367
|
/**
|
|
2368
|
+
* Removes the specified subscriber from the previously initialized list.
|
|
2369
|
+
*
|
|
2370
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
|
|
2371
|
+
*
|
|
473
2372
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2373
|
+
* @param emailAddress - Email address of the subscriber, or a `{EmailAddress, SubscriberKey}` object identifying the subscriber.
|
|
2374
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2375
|
+
* @example
|
|
2376
|
+
* Platform.Load("core", "1.1.5");
|
|
2377
|
+
* var myList = List.Init("myList");
|
|
2378
|
+
* var status = myList.Subscribers.Unsubscribe("aruiz@example.com");
|
|
474
2379
|
*/
|
|
475
2380
|
function Unsubscribe(emailAddress: string): string;
|
|
476
2381
|
/**
|
|
2382
|
+
* Updates the status of the specified subscriber on the previously initialized list.
|
|
2383
|
+
*
|
|
2384
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
|
|
2385
|
+
*
|
|
477
2386
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2387
|
+
* @param emailAddress - Email address of the subscriber, or a `{EmailAddress, SubscriberKey}` object identifying the subscriber.
|
|
2388
|
+
* @param status - New status of the subscriber on the list.
|
|
2389
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2390
|
+
* @example
|
|
2391
|
+
* Platform.Load("core", "1.1.5");
|
|
2392
|
+
* var myList = List.Init("myList");
|
|
2393
|
+
* var status = myList.Subscribers.Update("aruiz@example.com", "Active");
|
|
478
2394
|
*/
|
|
479
2395
|
function Update(emailAddress: string, status: string): string;
|
|
480
2396
|
/**
|
|
2397
|
+
* Adds the subscriber if not on the list, otherwise updates the supplied attributes. If `attributes.Status` is supplied, the subscriber's list status is updated.
|
|
2398
|
+
*
|
|
2399
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
|
|
2400
|
+
*
|
|
481
2401
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2402
|
+
* @param emailAddress - Email address of the subscriber, or a `{EmailAddress, SubscriberKey}` object identifying the subscriber.
|
|
2403
|
+
* @param attributes - Additional subscriber attributes to set or update.
|
|
2404
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2405
|
+
* @example
|
|
2406
|
+
* Platform.Load("core", "1.1.5");
|
|
2407
|
+
* var myList = List.Init("myList");
|
|
2408
|
+
* var status = myList.Subscribers.Upsert("aruiz@example.com", { ZipCode: "46202" });
|
|
482
2409
|
*/
|
|
483
2410
|
function Upsert(emailAddress: string, attributes: object): string;
|
|
484
2411
|
}
|
|
485
2412
|
declare namespace List.Subscribers.Tracking {
|
|
486
2413
|
/**
|
|
2414
|
+
* Returns an array of tracking data for subscribers matching the filter.
|
|
2415
|
+
*
|
|
2416
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
|
|
2417
|
+
*
|
|
487
2418
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2419
|
+
* @param filter - PascalCase WSProxy-style filter object identifying the subscribers.
|
|
2420
|
+
* @returns List of tracking records matching the filter.
|
|
2421
|
+
* @example
|
|
2422
|
+
* Platform.Load("core", "1.1.5");
|
|
2423
|
+
* var myList = List.Init("MyList");
|
|
2424
|
+
* var results = myList.Subscribers.Tracking.Retrieve({ Property: "SubscriberKey", SimpleOperator: "equals", Value: "MyKey" });
|
|
488
2425
|
*/
|
|
489
2426
|
function Retrieve(filter: object): object[];
|
|
490
2427
|
}
|
|
491
2428
|
declare namespace Subscriber {
|
|
492
2429
|
/**
|
|
2430
|
+
* Initializes a Subscriber instance bound to the specified subscriber key. Required before invoking any instance method on the returned object.
|
|
2431
|
+
*
|
|
2432
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2433
|
+
*
|
|
493
2434
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2435
|
+
* @param key - Subscriber key.
|
|
2436
|
+
* @returns An initialized Subscriber bound to the specified key.
|
|
2437
|
+
* @example
|
|
2438
|
+
* Platform.Load("core", "1");
|
|
2439
|
+
* var sub = Subscriber.Init("mySubscriber");
|
|
494
2440
|
*/
|
|
495
2441
|
function Init(key: string): any;
|
|
496
2442
|
/**
|
|
497
|
-
*
|
|
2443
|
+
* Creates a new subscriber from the supplied properties.
|
|
2444
|
+
*
|
|
2445
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2446
|
+
*
|
|
2447
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2448
|
+
* @param properties - JSON object describing the new subscriber (EmailAddress, SubscriberKey, EmailTypePreference, Attributes, Lists, ...).
|
|
2449
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2450
|
+
* @example
|
|
2451
|
+
* Platform.Load("core", "1.1.5");
|
|
2452
|
+
* var newSubscriber = {
|
|
2453
|
+
* EmailAddress: "test.008@example.com",
|
|
2454
|
+
* SubscriberKey: "20100730001",
|
|
2455
|
+
* EmailTypePreference: "Text",
|
|
2456
|
+
* Attributes: { "First Name": "test.008", "Last Name": "test.008" },
|
|
2457
|
+
* Lists: { Status: "Active", ID: 12345, Action: "Create" }
|
|
2458
|
+
* };
|
|
2459
|
+
* var status = Subscriber.Add(newSubscriber);
|
|
498
2460
|
*/
|
|
499
2461
|
function Add(properties: object): string;
|
|
500
2462
|
/**
|
|
2463
|
+
* Returns an array of subscribers matching the specified filter.
|
|
2464
|
+
*
|
|
2465
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2466
|
+
*
|
|
501
2467
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2468
|
+
* @param filter - PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
2469
|
+
* @returns List of subscribers matching the filter.
|
|
2470
|
+
* @example
|
|
2471
|
+
* Platform.Load("core", "1.1.5");
|
|
2472
|
+
* var results = Subscriber.Retrieve({ Property: "SubscriberKey", SimpleOperator: "equals", Value: "MySubscriberKey" });
|
|
502
2473
|
*/
|
|
503
2474
|
function Retrieve(filter: object): object[];
|
|
504
2475
|
/**
|
|
505
|
-
*
|
|
2476
|
+
* Creates a new subscriber, or updates an existing one matched by EmailAddress / SubscriberKey.
|
|
2477
|
+
*
|
|
2478
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2479
|
+
*
|
|
2480
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2481
|
+
* @param properties - JSON object describing the subscriber (EmailAddress, SubscriberKey, Attributes, ...).
|
|
2482
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2483
|
+
* @example
|
|
2484
|
+
* Platform.Load("core", "1");
|
|
2485
|
+
* var sub = {
|
|
2486
|
+
* EmailAddress: "test@example.com",
|
|
2487
|
+
* SubscriberKey: "test@example.com",
|
|
2488
|
+
* Attributes: [ { Name: "FirstName", Value: "Jane" } ]
|
|
2489
|
+
* };
|
|
2490
|
+
* var result = Subscriber.Upsert(sub);
|
|
2491
|
+
* Write(Stringify(result));
|
|
506
2492
|
*/
|
|
507
2493
|
function Upsert(properties: object): string;
|
|
508
2494
|
/**
|
|
2495
|
+
* Retrieves statistical data for the specified subscriber (sends, opens, clicks, bounces, unsubscribes).
|
|
2496
|
+
*
|
|
2497
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2498
|
+
*
|
|
509
2499
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2500
|
+
* @param subscriberKey - The subscriber key identifying the subscriber.
|
|
2501
|
+
* @returns A single object with subscriber statistics (not an array).
|
|
2502
|
+
* @example
|
|
2503
|
+
* Platform.Load("core", "1");
|
|
2504
|
+
* var stats = Subscriber.Statistics("test@example.com");
|
|
2505
|
+
* Write(Stringify(stats));
|
|
510
2506
|
*/
|
|
511
2507
|
function Statistics(subscriberKey: string): object;
|
|
512
2508
|
/**
|
|
2509
|
+
* Updates the previously initialized subscriber with the supplied attributes.
|
|
2510
|
+
*
|
|
2511
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2512
|
+
*
|
|
513
2513
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2514
|
+
* @param properties - Subscriber properties to change.
|
|
2515
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2516
|
+
* @example
|
|
2517
|
+
* Platform.Load("core", "1.1.5");
|
|
2518
|
+
* var subObj = Subscriber.Init("SubKey");
|
|
2519
|
+
* var status = subObj.Update({ EmailTypePreference: "HTML", Attributes: { "First Name": "Test", "Last Name": "User" } });
|
|
514
2520
|
*/
|
|
515
2521
|
function Update(properties: object): string;
|
|
516
2522
|
/**
|
|
2523
|
+
* Deletes the previously initialized subscriber.
|
|
2524
|
+
*
|
|
2525
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2526
|
+
*
|
|
517
2527
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2528
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2529
|
+
* @example
|
|
2530
|
+
* Platform.Load("core", "1.1.5");
|
|
2531
|
+
* var subObj = Subscriber.Init("SubKey");
|
|
2532
|
+
* var status = subObj.Remove();
|
|
518
2533
|
*/
|
|
519
2534
|
function Remove(): string;
|
|
520
2535
|
/**
|
|
2536
|
+
* Sets the previously initialized subscriber's status to `"Unsubscribed"`.
|
|
2537
|
+
*
|
|
2538
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2539
|
+
*
|
|
521
2540
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2541
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2542
|
+
* @example
|
|
2543
|
+
* Platform.Load("core", "1.1.5");
|
|
2544
|
+
* var subObj = Subscriber.Init("SubKey");
|
|
2545
|
+
* var status = subObj.Unsubscribe();
|
|
522
2546
|
*/
|
|
523
2547
|
function Unsubscribe(): string;
|
|
524
2548
|
}
|
|
525
2549
|
declare namespace Subscriber.Attributes {
|
|
526
2550
|
/**
|
|
2551
|
+
* Returns an array of attributes associated with the previously initialized subscriber.
|
|
2552
|
+
*
|
|
2553
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2554
|
+
*
|
|
527
2555
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2556
|
+
* @returns List of attribute objects for the subscriber.
|
|
2557
|
+
* @example
|
|
2558
|
+
* Platform.Load("core", "1.1.5");
|
|
2559
|
+
* var subObj = Subscriber.Init("SubKey");
|
|
2560
|
+
* var attributes = subObj.Attributes.Retrieve();
|
|
528
2561
|
*/
|
|
529
2562
|
function Retrieve(): object[];
|
|
530
2563
|
}
|
|
531
2564
|
declare namespace Subscriber.Lists {
|
|
532
2565
|
/**
|
|
2566
|
+
* Returns the lists the previously initialized subscriber is a member of.
|
|
2567
|
+
*
|
|
2568
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2569
|
+
*
|
|
533
2570
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2571
|
+
* @returns List of list objects the subscriber belongs to.
|
|
2572
|
+
* @example
|
|
2573
|
+
* Platform.Load("core", "1.1.5");
|
|
2574
|
+
* var subObj = Subscriber.Init("SubKey");
|
|
2575
|
+
* var listArray = subObj.Lists.Retrieve();
|
|
534
2576
|
*/
|
|
535
2577
|
function Retrieve(): object[];
|
|
536
2578
|
}
|
|
537
2579
|
declare namespace Email {
|
|
538
2580
|
/**
|
|
2581
|
+
* Initializes an Email instance bound to the specified external key. Required before invoking any other Email method on the returned instance. External keys cannot be set in the UI — set one via SOAP API, or look up the value via `Email.Retrieve()`.
|
|
2582
|
+
*
|
|
2583
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2584
|
+
*
|
|
539
2585
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2586
|
+
* @param key - External key of the email message.
|
|
2587
|
+
* @returns An initialized Email bound to the specified external key.
|
|
2588
|
+
* @example
|
|
2589
|
+
* Platform.Load("core", "1");
|
|
2590
|
+
* var myEmail = Email.Init("myEmail");
|
|
540
2591
|
*/
|
|
541
2592
|
function Init(key: string): any;
|
|
542
2593
|
/**
|
|
543
|
-
*
|
|
2594
|
+
* Creates a new email message from the supplied properties and returns an initialized email instance. Note: unlike most static `Add` methods, this returns an `EmailInstance`, not `"OK"`.
|
|
2595
|
+
*
|
|
2596
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2597
|
+
*
|
|
2598
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2599
|
+
* @param properties - JSON object describing the new email (CustomerKey, Name, optional CategoryID, HTMLBody, TextBody, Subject, EmailType, ...).
|
|
2600
|
+
* @returns An initialized Email bound to the newly-created email message.
|
|
2601
|
+
* @example
|
|
2602
|
+
* Platform.Load("core", "1.1.5");
|
|
2603
|
+
* var newMail = {
|
|
2604
|
+
* CustomerKey: "test_email_key",
|
|
2605
|
+
* Name: "Test Email",
|
|
2606
|
+
* HTMLBody: "<b>This is a test email</b>",
|
|
2607
|
+
* TextBody: "This is a test email",
|
|
2608
|
+
* Subject: "Test Email Subject",
|
|
2609
|
+
* EmailType: "HTML",
|
|
2610
|
+
* CharacterSet: "US-ASCII"
|
|
2611
|
+
* };
|
|
2612
|
+
* var myEmail = Email.Add(newMail);
|
|
544
2613
|
*/
|
|
545
2614
|
function Add(properties: object): any;
|
|
546
2615
|
/**
|
|
2616
|
+
* Returns an array of email messages matching the specified filter.
|
|
2617
|
+
*
|
|
2618
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2619
|
+
*
|
|
547
2620
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2621
|
+
* @param filter - PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
2622
|
+
* @returns List of email messages matching the filter.
|
|
2623
|
+
* @example
|
|
2624
|
+
* Platform.Load("core", "1.1.5");
|
|
2625
|
+
* var results = Email.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "myEmail" });
|
|
548
2626
|
*/
|
|
549
2627
|
function Retrieve(filter: object): object[];
|
|
550
2628
|
/**
|
|
2629
|
+
* Updates the email message with the supplied attributes.
|
|
2630
|
+
*
|
|
2631
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2632
|
+
*
|
|
551
2633
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2634
|
+
* @param properties - Attributes to change on the email message.
|
|
2635
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2636
|
+
* @example
|
|
2637
|
+
* Platform.Load("core", "1.1.5");
|
|
2638
|
+
* var myEmail = Email.Init("myEmail");
|
|
2639
|
+
* var status = myEmail.Update({ Name: "Updated Name", Subject: "Updated Email Subject" });
|
|
552
2640
|
*/
|
|
553
2641
|
function Update(properties: object): string;
|
|
554
2642
|
/**
|
|
2643
|
+
* Removes the previously initialized email message.
|
|
2644
|
+
*
|
|
2645
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2646
|
+
*
|
|
555
2647
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2648
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2649
|
+
* @example
|
|
2650
|
+
* Platform.Load("core", "1.1.5");
|
|
2651
|
+
* var myEmail = Email.Init("myEmail");
|
|
2652
|
+
* myEmail.Remove();
|
|
556
2653
|
*/
|
|
557
2654
|
function Remove(): string;
|
|
558
2655
|
/**
|
|
2656
|
+
* Runs validation checks on the previously initialized email message. Returns a `{Task: {ValidationStatus: boolean, ValidationMessages: string}}` object.
|
|
2657
|
+
*
|
|
2658
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2659
|
+
*
|
|
559
2660
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2661
|
+
* @returns Validation result with `Task.ValidationStatus` (boolean) and `Task.ValidationMessages` (string).
|
|
2662
|
+
* @example
|
|
2663
|
+
* Platform.Load("core", "1.1.5");
|
|
2664
|
+
* var myEmail = Email.Init("myEmail");
|
|
2665
|
+
* var results = myEmail.Validate();
|
|
2666
|
+
* Write(results.Task.ValidationStatus);
|
|
2667
|
+
* Write(results.Task.ValidationMessages);
|
|
560
2668
|
*/
|
|
561
2669
|
function Validate(): object;
|
|
562
2670
|
/**
|
|
2671
|
+
* Runs content checks on the previously initialized email message. Returns a `{Task: {CheckPassed: boolean, ResultMessage: string}}` object.
|
|
2672
|
+
*
|
|
2673
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2674
|
+
*
|
|
563
2675
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2676
|
+
* @returns Content-check result with `Task.CheckPassed` (boolean) and `Task.ResultMessage` (string).
|
|
2677
|
+
* @example
|
|
2678
|
+
* Platform.Load("core", "1.1.5");
|
|
2679
|
+
* var myEmail = Email.Init("myEmail");
|
|
2680
|
+
* var results = myEmail.CheckContent();
|
|
2681
|
+
* Write(results.Task.CheckPassed);
|
|
2682
|
+
* Write(results.Task.ResultMessage);
|
|
564
2683
|
*/
|
|
565
2684
|
function CheckContent(): object;
|
|
566
2685
|
}
|
|
567
2686
|
declare namespace Send {
|
|
568
2687
|
/**
|
|
2688
|
+
* Initializes a Send instance bound to the specified send ID. Required before invoking any other Send method on the returned instance.
|
|
2689
|
+
*
|
|
2690
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2691
|
+
*
|
|
569
2692
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2693
|
+
* @param id - Numeric ID of the send.
|
|
2694
|
+
* @returns An initialized Send bound to the specified send ID.
|
|
2695
|
+
* @example
|
|
2696
|
+
* Platform.Load("core", "1");
|
|
2697
|
+
* var s = Send.Init(12345);
|
|
570
2698
|
*/
|
|
571
2699
|
function Init(id: number): any;
|
|
572
2700
|
/**
|
|
573
|
-
*
|
|
2701
|
+
* Creates a new send to the specified email and list(s). Pass an `options` object to override From name, From address, subject, send time, etc.
|
|
2702
|
+
*
|
|
2703
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2704
|
+
*
|
|
2705
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2706
|
+
* @param emailKey - CustomerKey of the email message to associate with the send.
|
|
2707
|
+
* @param listIds - Array of list IDs to send to.
|
|
2708
|
+
* @param options - Optional send options (FromName, FromAddress, Subject, send time, ...).
|
|
2709
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2710
|
+
* @example
|
|
2711
|
+
* Platform.Load("core", "1.1.5");
|
|
2712
|
+
* var status = Send.Add("test_email", [12345, 12346]);
|
|
2713
|
+
* var options = { FromName: "JSON Specified Name", FromAddress: "aruiz@example.com", Subject: "JSON Test Mail" };
|
|
2714
|
+
* var status2 = Send.Add("test_email", [12345, 12346], options);
|
|
574
2715
|
*/
|
|
575
2716
|
function Add(emailKey: string, listIds: any[], options?: object): string;
|
|
576
2717
|
/**
|
|
2718
|
+
* Returns an array of sends matching the specified filter.
|
|
2719
|
+
*
|
|
2720
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2721
|
+
*
|
|
577
2722
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2723
|
+
* @param filter - PascalCase WSProxy-style filter object — simple or compound with `LeftOperand`/`LogicalOperator`/`RightOperand`.
|
|
2724
|
+
* @returns List of sends matching the filter.
|
|
2725
|
+
* @example
|
|
2726
|
+
* Platform.Load("core", "1.1.5");
|
|
2727
|
+
* var sends = Send.Retrieve({ Property: "ID", SimpleOperator: "equals", Value: 12345 });
|
|
578
2728
|
*/
|
|
579
2729
|
function Retrieve(filter: object): object[];
|
|
580
2730
|
/**
|
|
2731
|
+
* Returns information about the lists targeted by a send. Filter must restrict results to specific send ID(s).
|
|
2732
|
+
*
|
|
2733
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2734
|
+
*
|
|
581
2735
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2736
|
+
* @param filter - WSProxy-style filter restricting results to specific send ID(s).
|
|
2737
|
+
* @returns List of list objects associated with matching sends; throws on failure.
|
|
2738
|
+
* @example
|
|
2739
|
+
* Platform.Load("core", "1.1.5");
|
|
2740
|
+
* var listsSentTo = Send.RetrieveLists({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
582
2741
|
*/
|
|
583
2742
|
function RetrieveLists(filter: object): object[];
|
|
584
2743
|
/**
|
|
2744
|
+
* Removes the previously initialized send.
|
|
2745
|
+
*
|
|
2746
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2747
|
+
*
|
|
585
2748
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2749
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2750
|
+
* @example
|
|
2751
|
+
* Platform.Load("core", "1.1.5");
|
|
2752
|
+
* var s = Send.Init(12345);
|
|
2753
|
+
* s.Remove();
|
|
586
2754
|
*/
|
|
587
2755
|
function Remove(): string;
|
|
588
2756
|
/**
|
|
2757
|
+
* Attempts to cancel the previously initialized send.
|
|
2758
|
+
*
|
|
2759
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2760
|
+
*
|
|
589
2761
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2762
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2763
|
+
* @example
|
|
2764
|
+
* Platform.Load("core", "1.1.5");
|
|
2765
|
+
* var mySend = Send.Init(12345);
|
|
2766
|
+
* var status = mySend.CancelSend();
|
|
590
2767
|
*/
|
|
591
2768
|
function CancelSend(): string;
|
|
592
2769
|
}
|
|
593
2770
|
declare namespace Send.Tracking {
|
|
594
2771
|
/**
|
|
2772
|
+
* Returns tracking data for sends matching the filter. This is a static call on `Send.Tracking.*` — no `Send.Init()` is required.
|
|
2773
|
+
*
|
|
2774
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2775
|
+
*
|
|
595
2776
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2777
|
+
* @param filter - WSProxy-style filter object.
|
|
2778
|
+
* @returns List of tracking records matching the filter.
|
|
2779
|
+
* @example
|
|
2780
|
+
* Platform.Load("core", "1.1.5");
|
|
2781
|
+
* var sendTracking = Send.Tracking.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
596
2782
|
*/
|
|
597
2783
|
function Retrieve(filter: object): object[];
|
|
598
2784
|
/**
|
|
2785
|
+
* Returns click tracking data for the previously initialized send.
|
|
2786
|
+
*
|
|
2787
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2788
|
+
*
|
|
599
2789
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2790
|
+
* @param filter - WSProxy-style filter restricting results.
|
|
2791
|
+
* @returns List of click tracking records matching the filter.
|
|
2792
|
+
* @example
|
|
2793
|
+
* Platform.Load("core", "1.1.5");
|
|
2794
|
+
* var singleSend = Send.Init(12345);
|
|
2795
|
+
* var results = singleSend.Tracking.ClickRetrieve({ Property: "ID", SimpleOperator: "equals", Value: 12345 });
|
|
600
2796
|
*/
|
|
601
2797
|
function ClickRetrieve(filter: object): object[];
|
|
602
2798
|
/**
|
|
603
|
-
*
|
|
2799
|
+
* Returns aggregated tracking data for the previously initialized send. Aggregates by `type` over the date range, grouped by `groupBy`.
|
|
2800
|
+
*
|
|
2801
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2802
|
+
*
|
|
2803
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2804
|
+
* @param type - Type of data to aggregate.
|
|
2805
|
+
* @param startDate - Start date of the data period (MM-DD-YYYY).
|
|
2806
|
+
* @param endDate - End date of the data period (MM-DD-YYYY).
|
|
2807
|
+
* @param groupBy - Interval used to aggregate data.
|
|
2808
|
+
* @returns List of aggregated tracking records.
|
|
2809
|
+
* @example
|
|
2810
|
+
* Platform.Load("core", "1.1.5");
|
|
2811
|
+
* var singleSend = Send.Init(12345);
|
|
2812
|
+
* var results = singleSend.Tracking.TotalByIntervalRetrieve("Click", "07-01-2010", "07-31-2010", "day");
|
|
604
2813
|
*/
|
|
605
2814
|
function TotalByIntervalRetrieve(type: string, startDate: string, endDate: string, groupBy: string): object[];
|
|
606
2815
|
}
|
|
607
2816
|
declare namespace Send.Definition {
|
|
608
2817
|
/**
|
|
2818
|
+
* Initializes a SendDefinition instance bound to the specified external key. Required before invoking any instance method on the returned object.
|
|
2819
|
+
*
|
|
2820
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2821
|
+
*
|
|
609
2822
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2823
|
+
* @param key - External key of the send definition.
|
|
2824
|
+
* @returns An initialized SendDefinition bound to the specified external key.
|
|
2825
|
+
* @example
|
|
2826
|
+
* Platform.Load("core", "1.1.5");
|
|
2827
|
+
* var esd = Send.Definition.Init("myESD");
|
|
610
2828
|
*/
|
|
611
2829
|
function Init(key: string): any;
|
|
612
2830
|
/**
|
|
613
|
-
*
|
|
2831
|
+
* Creates a new send definition.
|
|
2832
|
+
*
|
|
2833
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2834
|
+
*
|
|
2835
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2836
|
+
* @param esdParams - Object with CustomerKey, Name, EmailSubject for the new send definition.
|
|
2837
|
+
* @param sendClassificationKey - CustomerKey of the related send classification.
|
|
2838
|
+
* @param emailKey - CustomerKey of the email message to use.
|
|
2839
|
+
* @param listIds - Array of list IDs targeted by the send definition.
|
|
2840
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2841
|
+
* @example
|
|
2842
|
+
* Platform.Load("core", "1");
|
|
2843
|
+
* var esdParams = { CustomerKey: "example_esd", Name: "Example Send Definition", EmailSubject: "Sent By Example Send Definition" };
|
|
2844
|
+
* Send.Definition.Add(esdParams, "example_sc_key", "example_email_key", [12345, 12346]);
|
|
614
2845
|
*/
|
|
615
2846
|
function Add(esdParams: object, sendClassificationKey: string, emailKey: string, listIds: any[]): string;
|
|
616
2847
|
/**
|
|
617
|
-
*
|
|
2848
|
+
* Creates a new send definition that targets a sendable Data Extension.
|
|
2849
|
+
*
|
|
2850
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2851
|
+
*
|
|
2852
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2853
|
+
* @param esdParams - Object with CustomerKey, Name, EmailSubject for the new send definition.
|
|
2854
|
+
* @param sendClassificationKey - CustomerKey of the related send classification.
|
|
2855
|
+
* @param emailKey - CustomerKey of the email message to use.
|
|
2856
|
+
* @param sendableDataExtensionKey - CustomerKey of the sendable Data Extension.
|
|
2857
|
+
* @param publicationListKey - CustomerKey of the publication list to associate.
|
|
2858
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2859
|
+
* @example
|
|
2860
|
+
* Platform.Load("core", "1.1.5");
|
|
2861
|
+
* var esdParams = { CustomerKey: "ssjs_de_esd_1c", Name: "SSJS DE Test ESD3", EmailSubject: "Third send By Test DE Send Definition" };
|
|
2862
|
+
* var status = Send.Definition.AddWithDE(esdParams, "scKey", "test_email", "deKey", "myPubList");
|
|
618
2863
|
*/
|
|
619
2864
|
function AddWithDE(esdParams: object, sendClassificationKey: string, emailKey: string, sendableDataExtensionKey: string, publicationListKey: string): string;
|
|
620
2865
|
/**
|
|
621
|
-
*
|
|
2866
|
+
* Creates a new send definition that targets the audience defined by a filter definition.
|
|
2867
|
+
*
|
|
2868
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2869
|
+
*
|
|
2870
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2871
|
+
* @param esdParams - Object with CustomerKey, Name, EmailSubject for the new send definition.
|
|
2872
|
+
* @param sendClassificationKey - CustomerKey of the related send classification.
|
|
2873
|
+
* @param emailKey - CustomerKey of the email message to use.
|
|
2874
|
+
* @param filterDefinitionKey - CustomerKey of the filter definition.
|
|
2875
|
+
* @param listId - ID of the list targeted by the filter.
|
|
2876
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2877
|
+
* @example
|
|
2878
|
+
* Platform.Load("core", "1.1.5");
|
|
2879
|
+
* var esdParams = { CustomerKey: "filterDef_esd", Name: "Example Filtered Send Definition", EmailSubject: "Sent By Filtered Send Definition" };
|
|
2880
|
+
* var status = Send.Definition.AddWithFilterDefinition(esdParams, "scKey", "test_email", "fdKey", 144);
|
|
622
2881
|
*/
|
|
623
2882
|
function AddWithFilterDefinition(esdParams: object, sendClassificationKey: string, emailKey: string, filterDefinitionKey: string, listId: number): string;
|
|
624
2883
|
/**
|
|
2884
|
+
* Returns an array of send definitions, optionally filtered. When no filter is supplied, all send definitions are returned.
|
|
2885
|
+
*
|
|
2886
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2887
|
+
*
|
|
625
2888
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2889
|
+
* @param filter - Optional WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
2890
|
+
* @returns List of send definitions matching the filter (or all when no filter is supplied).
|
|
2891
|
+
* @example
|
|
2892
|
+
* Platform.Load("core", "1.1.5");
|
|
2893
|
+
* var esd = Send.Definition.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "ssjs_test_esd" });
|
|
626
2894
|
*/
|
|
627
2895
|
function Retrieve(filter?: object): object[];
|
|
628
2896
|
/**
|
|
2897
|
+
* Updates the previously initialized send definition.
|
|
2898
|
+
*
|
|
2899
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2900
|
+
*
|
|
629
2901
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2902
|
+
* @param properties - Properties to update.
|
|
2903
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2904
|
+
* @example
|
|
2905
|
+
* Platform.Load("core", "1.1.5");
|
|
2906
|
+
* var sendDef = Send.Definition.Init("MY_SEND_DEF_KEY");
|
|
2907
|
+
* var result = sendDef.Update({ Name: "Updated Send Definition Name" });
|
|
630
2908
|
*/
|
|
631
2909
|
function Update(properties: object): string;
|
|
632
2910
|
/**
|
|
2911
|
+
* Deletes the previously initialized send definition.
|
|
2912
|
+
*
|
|
2913
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2914
|
+
*
|
|
633
2915
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2916
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2917
|
+
* @example
|
|
2918
|
+
* Platform.Load("core", "1.1.5");
|
|
2919
|
+
* var esd = Send.Definition.Init("myESD");
|
|
2920
|
+
* var status = esd.Remove();
|
|
634
2921
|
*/
|
|
635
2922
|
function Remove(): string;
|
|
636
2923
|
/**
|
|
2924
|
+
* Sends email messages to the lists associated with the previously initialized send definition.
|
|
2925
|
+
*
|
|
2926
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2927
|
+
*
|
|
637
2928
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2929
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2930
|
+
* @example
|
|
2931
|
+
* Platform.Load("core", "1.1.5");
|
|
2932
|
+
* var esd = Send.Definition.Init("myESD");
|
|
2933
|
+
* var status = esd.Send();
|
|
638
2934
|
*/
|
|
639
2935
|
function Send(): string;
|
|
640
2936
|
}
|
|
641
2937
|
declare namespace TriggeredSend {
|
|
642
2938
|
/**
|
|
2939
|
+
* Initializes a TriggeredSend instance bound to the specified external key. Required before invoking any instance method on the returned object. Note: TriggeredSend methods cannot be used in the context of an email message or email preview.
|
|
2940
|
+
*
|
|
2941
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
2942
|
+
*
|
|
643
2943
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2944
|
+
* @param key - External key of the triggered send definition.
|
|
2945
|
+
* @returns An initialized TriggeredSend bound to the specified external key.
|
|
2946
|
+
* @example
|
|
2947
|
+
* Platform.Load("core", "1");
|
|
2948
|
+
* var triggeredSend = TriggeredSend.Init("support");
|
|
644
2949
|
*/
|
|
645
2950
|
function Init(key: string): any;
|
|
646
2951
|
/**
|
|
647
|
-
*
|
|
2952
|
+
* Creates a new triggered send definition from the supplied properties and returns an initialized TriggeredSend instance. Note: unlike most static `Add` methods, this returns a `TriggeredSendInstance`, not `"OK"`.
|
|
2953
|
+
*
|
|
2954
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
2955
|
+
*
|
|
2956
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2957
|
+
* @param properties - JSON object describing the new triggered send definition (Name, CustomerKey, FromName, FromAddress, EmailID, SendClassificationID, ...).
|
|
2958
|
+
* @returns An initialized TriggeredSend bound to the newly-created triggered send definition.
|
|
2959
|
+
* @example
|
|
2960
|
+
* Platform.Load("core", "1.1.5");
|
|
2961
|
+
* var newTSD = {
|
|
2962
|
+
* Name: "Test TSD",
|
|
2963
|
+
* CustomerKey: "ssjs_tsd_key",
|
|
2964
|
+
* FromName: "Test From Name",
|
|
2965
|
+
* FromAddress: "me@example.com",
|
|
2966
|
+
* EmailID: 12345,
|
|
2967
|
+
* SendClassificationID: 54321
|
|
2968
|
+
* };
|
|
2969
|
+
* var tsd = TriggeredSend.Add(newTSD);
|
|
648
2970
|
*/
|
|
649
2971
|
function Add(properties: object): any;
|
|
650
2972
|
/**
|
|
2973
|
+
* Returns an array of triggered send definitions matching the specified filter.
|
|
2974
|
+
*
|
|
2975
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
2976
|
+
*
|
|
651
2977
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2978
|
+
* @param filter - PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
2979
|
+
* @returns List of triggered send definitions matching the filter.
|
|
2980
|
+
* @example
|
|
2981
|
+
* Platform.Load("core", "1.1.5");
|
|
2982
|
+
* var results = TriggeredSend.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "ssjs_tsd_key" });
|
|
652
2983
|
*/
|
|
653
2984
|
function Retrieve(filter: object): object[];
|
|
654
2985
|
/**
|
|
2986
|
+
* Updates the previously initialized triggered send definition.
|
|
2987
|
+
*
|
|
2988
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
2989
|
+
*
|
|
655
2990
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2991
|
+
* @param properties - Attributes to change on the triggered send definition.
|
|
2992
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2993
|
+
* @example
|
|
2994
|
+
* Platform.Load("core", "1.1.5");
|
|
2995
|
+
* var tsd = TriggeredSend.Init("triggeredSend");
|
|
2996
|
+
* var status = tsd.Update({ Name: "Updated TSD Name" });
|
|
656
2997
|
*/
|
|
657
2998
|
function Update(properties: object): string;
|
|
658
2999
|
/**
|
|
3000
|
+
* Starts (reactivates) a paused triggered send definition.
|
|
3001
|
+
*
|
|
3002
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3003
|
+
*
|
|
659
3004
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3005
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
3006
|
+
* @example
|
|
3007
|
+
* Platform.Load("core", "1.1.5");
|
|
3008
|
+
* var ts = TriggeredSend.Init("MY_TRIGGERED_SEND_KEY");
|
|
3009
|
+
* var result = ts.Start();
|
|
660
3010
|
*/
|
|
661
3011
|
function Start(): string;
|
|
662
3012
|
/**
|
|
3013
|
+
* Pauses an active triggered send definition.
|
|
3014
|
+
*
|
|
3015
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3016
|
+
*
|
|
663
3017
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3018
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
3019
|
+
* @example
|
|
3020
|
+
* Platform.Load("core", "1.1.5");
|
|
3021
|
+
* var ts = TriggeredSend.Init("MY_TRIGGERED_SEND_KEY");
|
|
3022
|
+
* var status = ts.Pause();
|
|
664
3023
|
*/
|
|
665
3024
|
function Pause(): string;
|
|
666
3025
|
/**
|
|
3026
|
+
* Publishes a triggered send definition, making it active and ready to accept sends. Use this to move a definition from Draft / Inactive to Active.
|
|
3027
|
+
*
|
|
3028
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3029
|
+
*
|
|
667
3030
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3031
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
3032
|
+
* @example
|
|
3033
|
+
* Platform.Load("core", "1.1.5");
|
|
3034
|
+
* var ts = TriggeredSend.Init("MY_TRIGGERED_SEND_KEY");
|
|
3035
|
+
* var result = ts.Publish();
|
|
668
3036
|
*/
|
|
669
3037
|
function Publish(): string;
|
|
670
3038
|
/**
|
|
3039
|
+
* Sends an email using the previously initialized triggered send definition. On failure, inspect `<TriggeredSendInstance>.LastMessage` for error details.
|
|
3040
|
+
*
|
|
3041
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3042
|
+
*
|
|
671
3043
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3044
|
+
* @param emailAddress - Email address to send to. SubscriberKey is **not** supported.
|
|
3045
|
+
* @param sendTimeAttributes - Optional object with dynamic attributes to include in the send.
|
|
3046
|
+
* @returns Returns "OK" on success or "Error"; throws on a hard failure.
|
|
3047
|
+
* @example
|
|
3048
|
+
* Platform.Load("core", "1.1.5");
|
|
3049
|
+
* var ts = TriggeredSend.Init("triggeredSend");
|
|
3050
|
+
* var status = ts.Send("aruiz@example.com", { FirstName: "Angel", CouponCode: "AA1AF" });
|
|
3051
|
+
* if (status != "OK") { var message = ts.LastMessage; }
|
|
672
3052
|
*/
|
|
673
3053
|
function Send(emailAddress: string, sendTimeAttributes?: object): string;
|
|
674
3054
|
}
|
|
675
3055
|
declare namespace TriggeredSend.Tracking {
|
|
676
3056
|
/**
|
|
3057
|
+
* Returns tracking data for the previously initialized triggered send definition.
|
|
3058
|
+
*
|
|
3059
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3060
|
+
*
|
|
677
3061
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3062
|
+
* @param filter - Optional WSProxy-style filter object.
|
|
3063
|
+
* @returns List of tracking records.
|
|
3064
|
+
* @example
|
|
3065
|
+
* Platform.Load("core", "1.1.5");
|
|
3066
|
+
* var tsd = TriggeredSend.Init("MyTSDKey");
|
|
3067
|
+
* var tsdTracking = tsd.Tracking.Retrieve();
|
|
678
3068
|
*/
|
|
679
3069
|
function Retrieve(filter?: object): object[];
|
|
680
3070
|
}
|
|
681
3071
|
declare namespace TriggeredSend.Tracking.Clicks {
|
|
682
3072
|
/**
|
|
3073
|
+
* Returns click tracking information for the previously initialized triggered send definition.
|
|
3074
|
+
*
|
|
3075
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3076
|
+
*
|
|
683
3077
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3078
|
+
* @param filter - WSProxy-style filter restricting click results.
|
|
3079
|
+
* @returns List of click tracking records matching the filter.
|
|
3080
|
+
* @example
|
|
3081
|
+
* Platform.Load("core", "1.1.5");
|
|
3082
|
+
* var tsd = TriggeredSend.Init("MyTSDKey");
|
|
3083
|
+
* var results = tsd.Tracking.Clicks.Retrieve({ Property: "SendUrlID", SimpleOperator: "equals", Value: 12345 });
|
|
684
3084
|
*/
|
|
685
3085
|
function Retrieve(filter: object): object[];
|
|
686
3086
|
}
|
|
687
3087
|
declare namespace TriggeredSend.Tracking.TotalByInterval {
|
|
688
3088
|
/**
|
|
689
|
-
*
|
|
3089
|
+
* Returns aggregated tracking data for the previously initialized triggered send. Aggregates by `type` over the date range, grouped by `groupBy`.
|
|
3090
|
+
*
|
|
3091
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3092
|
+
*
|
|
3093
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3094
|
+
* @param type - Type of data to aggregate.
|
|
3095
|
+
* @param startDate - Start date of the data period (MM-DD-YYYY).
|
|
3096
|
+
* @param endDate - End date of the data period (MM-DD-YYYY).
|
|
3097
|
+
* @param groupBy - Interval used to aggregate data.
|
|
3098
|
+
* @returns List of aggregated tracking records.
|
|
3099
|
+
* @example
|
|
3100
|
+
* Platform.Load("core", "1.1.5");
|
|
3101
|
+
* var tsd = TriggeredSend.Init("MyTSDKey");
|
|
3102
|
+
* var results = tsd.Tracking.TotalByInterval.Retrieve("Click", "07-01-2010", "07-31-2010", "day");
|
|
690
3103
|
*/
|
|
691
3104
|
function Retrieve(type: string, startDate: string, endDate: string, groupBy: string): object[];
|
|
692
3105
|
}
|
|
693
3106
|
declare namespace DataExtension {
|
|
694
3107
|
/**
|
|
3108
|
+
* Initializes a DataExtension instance bound to the specified external key. Required before invoking any `Fields` or `Rows` sub-namespace method on the returned instance. Note: Core Library DataExtension methods do not support enterprise-level data extensions.
|
|
3109
|
+
*
|
|
3110
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension/)
|
|
3111
|
+
*
|
|
695
3112
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3113
|
+
* @param key - External key of the data extension.
|
|
3114
|
+
* @returns An initialized DataExtension bound to the specified external key.
|
|
3115
|
+
* @example
|
|
3116
|
+
* Platform.Load("core", "1.1.5");
|
|
3117
|
+
* var birthdayDE = DataExtension.Init("birthdayDE");
|
|
696
3118
|
*/
|
|
697
3119
|
function Init(key: string): DataExtensionInstance;
|
|
698
3120
|
/**
|
|
699
|
-
*
|
|
3121
|
+
* Creates a new data extension from the supplied properties and returns an initialized DataExtension instance. Note: unlike most static `Add` methods, this returns a `DataExtensionInstance`, not `"OK"`.
|
|
3122
|
+
*
|
|
3123
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension/)
|
|
3124
|
+
*
|
|
3125
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3126
|
+
* @param properties - JSON object describing the new data extension (CustomerKey, Name, Fields[], optional SendableInfo).
|
|
3127
|
+
* @returns An initialized DataExtension bound to the newly-created data extension.
|
|
3128
|
+
* @example
|
|
3129
|
+
* Platform.Load("core", "1.1.5");
|
|
3130
|
+
* var deObj = {
|
|
3131
|
+
* CustomerKey: "SendableDE",
|
|
3132
|
+
* Name: "Sendable Data Extension",
|
|
3133
|
+
* Fields: [
|
|
3134
|
+
* { Name: "SubKey", FieldType: "Text", IsPrimaryKey: true, MaxLength: 50, IsRequired: true },
|
|
3135
|
+
* { Name: "SecondField", FieldType: "Text", MaxLength: 50 }
|
|
3136
|
+
* ],
|
|
3137
|
+
* SendableInfo: {
|
|
3138
|
+
* Field: { Name: "SubKey", FieldType: "Text" },
|
|
3139
|
+
* RelatesOn: "Subscriber Key"
|
|
3140
|
+
* }
|
|
3141
|
+
* };
|
|
3142
|
+
* var de = DataExtension.Add(deObj);
|
|
700
3143
|
*/
|
|
701
3144
|
function Add(properties: object): DataExtensionInstance;
|
|
702
3145
|
/**
|
|
3146
|
+
* Returns an array of data extensions matching the specified filter. Pass `queryAllAccounts: true` to search all accounts accessible to the authenticated user.
|
|
3147
|
+
*
|
|
3148
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension/)
|
|
3149
|
+
*
|
|
703
3150
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3151
|
+
* @param filter - PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
3152
|
+
* @param queryAllAccounts - When `true`, search across all accounts accessible to the authenticated user. Defaults to `false`.
|
|
3153
|
+
* @returns List of data extensions matching the filter. Limit data extension external keys to 36 characters for downstream compatibility.
|
|
3154
|
+
* @example
|
|
3155
|
+
* Platform.Load("core", "1.1.5");
|
|
3156
|
+
* var results = DataExtension.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "myDEKey" });
|
|
704
3157
|
*/
|
|
705
3158
|
function Retrieve(filter: object, queryAllAccounts?: boolean): object[];
|
|
706
3159
|
}
|
|
707
3160
|
declare namespace DataExtension.Fields {
|
|
708
3161
|
/**
|
|
3162
|
+
* Adds a field to the previously initialized data extension. `properties.Name` is required; the rest (`CustomerKey`, `FieldType`, `MaxLength`, `IsRequired`, `IsPrimaryKey`, `Ordinal`, `Scale`, `DefaultValue`) are optional. `FieldType` accepts: 'Boolean', 'Date', 'Decimal', 'EmailAddress', 'Locale', 'Number', 'Phone', 'Text'.
|
|
3163
|
+
*
|
|
3164
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
|
|
3165
|
+
*
|
|
709
3166
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3167
|
+
* @param properties - Object describing the new field.
|
|
3168
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
3169
|
+
* @example
|
|
3170
|
+
* Platform.Load("core", "1.1.5");
|
|
3171
|
+
* var de = DataExtension.Init("SSJSTest");
|
|
3172
|
+
* var newField = { Name: "NewFieldV2", CustomerKey: "CustomerKey", FieldType: "Number", IsRequired: true, DefaultValue: "100" };
|
|
3173
|
+
* var status = de.Fields.Add(newField);
|
|
710
3174
|
*/
|
|
711
3175
|
function Add(properties: object): string;
|
|
712
3176
|
/**
|
|
3177
|
+
* Returns an array of field definitions for the previously initialized data extension.
|
|
3178
|
+
*
|
|
3179
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
|
|
3180
|
+
*
|
|
713
3181
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3182
|
+
* @returns List of field-definition objects.
|
|
3183
|
+
* @example
|
|
3184
|
+
* Platform.Load("core", "1.1.5");
|
|
3185
|
+
* var birthdayDE = DataExtension.Init("birthdayDE");
|
|
3186
|
+
* var fields = birthdayDE.Fields.Retrieve();
|
|
714
3187
|
*/
|
|
715
3188
|
function Retrieve(): object[];
|
|
716
3189
|
/**
|
|
3190
|
+
* Updates which data extension field is used to relate the data extension to the All Subscribers list during sending. Pass the name of the data extension field, and which subscriber attribute it should map to.
|
|
3191
|
+
*
|
|
3192
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
|
|
3193
|
+
*
|
|
717
3194
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3195
|
+
* @param deFieldName - Name of the data extension field that should make the connection to the subscriber list.
|
|
3196
|
+
* @param subscriberField - Subscriber attribute to map the data extension field to.
|
|
3197
|
+
* @returns Returns "OK" on success or throws on failure (assumed; doc has no `@returns`, treated as `"OK"` for consistency with sibling `Fields.*` methods).
|
|
3198
|
+
* @example
|
|
3199
|
+
* Platform.Load("core", "1.1.5");
|
|
3200
|
+
* var updateDE = DataExtension.Init("sendableDataExtension");
|
|
3201
|
+
* var status = updateDE.Fields.UpdateSendableField("DifferentSubKey", "Subscriber Key");
|
|
718
3202
|
*/
|
|
719
3203
|
function UpdateSendableField(deFieldName: string, subscriberField: string): string;
|
|
720
3204
|
}
|
|
721
3205
|
declare namespace DataExtension.Rows {
|
|
722
3206
|
/**
|
|
723
|
-
*
|
|
3207
|
+
* Adds one or more rows to the previously initialized data extension.
|
|
3208
|
+
*
|
|
3209
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
|
|
3210
|
+
*
|
|
3211
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3212
|
+
* @param rowData - Array of objects, one per row to add. Each object's keys must match data extension field names.
|
|
3213
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
3214
|
+
* @example
|
|
3215
|
+
* Platform.Load("core", "1.1.5");
|
|
3216
|
+
* var arrContacts = [
|
|
3217
|
+
* { Email: "jdoe@example.com", FirstName: "John", LastName: "Doe" },
|
|
3218
|
+
* { Email: "aruiz@example.com", FirstName: "Angel", LastName: "Ruiz" }
|
|
3219
|
+
* ];
|
|
3220
|
+
* var birthdayDE = DataExtension.Init("birthdayDE");
|
|
3221
|
+
* birthdayDE.Rows.Add(arrContacts);
|
|
724
3222
|
*/
|
|
725
3223
|
function Add(rowData: any[]): string;
|
|
726
3224
|
/**
|
|
727
|
-
*
|
|
3225
|
+
* Returns rows where the specified columns equal the specified values (AND-joined). Optionally limits results and orders by a field. When initializing a data extension for `Lookup()` from an email message, you must use the data extension Name; on landing pages, either Name or external key works — make them identical to be safe.
|
|
3226
|
+
*
|
|
3227
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
|
|
3228
|
+
*
|
|
3229
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3230
|
+
* @param searchFieldNames - Array of column names to match against.
|
|
3231
|
+
* @param searchValues - Array of values to match (one per column, in order).
|
|
3232
|
+
* @param limit - Maximum number of rows to return.
|
|
3233
|
+
* @param orderByFieldName - Field to order results by.
|
|
3234
|
+
* @returns Rows matching the lookup criteria.
|
|
3235
|
+
* @example
|
|
3236
|
+
* Platform.Load("core", "1.1.5");
|
|
3237
|
+
* var testDE = DataExtension.Init("testDE");
|
|
3238
|
+
* var data = testDE.Rows.Lookup(["Age"], [25], 2, "LastName");
|
|
728
3239
|
*/
|
|
729
3240
|
function Lookup(searchFieldNames: any[], searchValues: any[], limit?: number, orderByFieldName?: string): object[];
|
|
730
3241
|
/**
|
|
3242
|
+
* Deletes rows from the previously initialized data extension where the specified columns equal the specified values (AND-joined). For large deletion requests, batch the work — this method times out on long-running deletes.
|
|
3243
|
+
*
|
|
3244
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
|
|
3245
|
+
*
|
|
731
3246
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3247
|
+
* @param columnNames - Array of column names to match against.
|
|
3248
|
+
* @param columnValues - Array of values to match (one per column, in order).
|
|
3249
|
+
* @returns The number of rows that were modified (deleted).
|
|
3250
|
+
* @example
|
|
3251
|
+
* Platform.Load("Core", "1.1.5");
|
|
3252
|
+
* var memberDE = DataExtension.Init("MembershipRewards");
|
|
3253
|
+
* var result = memberDE.Rows.Remove(["Area"], ["Kensington"]);
|
|
732
3254
|
*/
|
|
733
3255
|
function Remove(columnNames: any[], columnValues: any[]): number;
|
|
734
3256
|
/**
|
|
3257
|
+
* Retrieves up to 2500 rows from the previously initialized data extension. When called without a filter, returns all rows (subject to the 2500-row cap). Cannot be used in the context of an email message or email preview.
|
|
3258
|
+
*
|
|
3259
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
|
|
3260
|
+
*
|
|
735
3261
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3262
|
+
* @param filter - WSProxy-style filter object — simple `{Property, SimpleOperator, Value}` or compound with `LeftOperand`/`LogicalOperator`/`RightOperand`. Optional per the example, despite the doc table marking `Required: Yes`.
|
|
3263
|
+
* @returns Rows from the data extension matching the filter (or all rows when no filter is supplied).
|
|
3264
|
+
* @example
|
|
3265
|
+
* Platform.Load("core", "1.1.5");
|
|
3266
|
+
* var birthdayDE = DataExtension.Init("birthdayDE");
|
|
3267
|
+
* var data = birthdayDE.Rows.Retrieve();
|
|
3268
|
+
* var filter = { Property: "Age", SimpleOperator: "greaterThan", Value: 20 };
|
|
3269
|
+
* var moredata = birthdayDE.Rows.Retrieve(filter);
|
|
736
3270
|
*/
|
|
737
3271
|
function Retrieve(filter?: object): object[];
|
|
738
3272
|
/**
|
|
739
|
-
*
|
|
3273
|
+
* Updates the columns of rows where `whereFieldNames` equal `whereValues` (AND-joined). Throws if no row matches.
|
|
3274
|
+
*
|
|
3275
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
|
|
3276
|
+
*
|
|
3277
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3278
|
+
* @param rowData - Object whose keys are columns to update and values are the new values.
|
|
3279
|
+
* @param whereFieldNames - Array of column names to match against.
|
|
3280
|
+
* @param whereValues - Array of values to match (one per column, in order).
|
|
3281
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
3282
|
+
* @example
|
|
3283
|
+
* Platform.Load("Core", "1");
|
|
3284
|
+
* var dataExt = DataExtension.Init("NTO Customer List");
|
|
3285
|
+
* var fieldsToUpdate = { StateProvince: "QC", PreferredActivity: "Sailing" };
|
|
3286
|
+
* var result = dataExt.Rows.Update(fieldsToUpdate, ["MemberId", "Country"], [9868600, "CA"]);
|
|
740
3287
|
*/
|
|
741
3288
|
function Update(rowData: object, whereFieldNames: any[], whereValues: any[]): string;
|
|
742
3289
|
}
|
|
743
3290
|
declare namespace DateTime.TimeZone {
|
|
744
3291
|
/**
|
|
3292
|
+
* Retrieves an array of time zones matching the specified filter criteria. If no filter is supplied the function returns all available time zones.
|
|
3293
|
+
*
|
|
3294
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/datetime-timezone/)
|
|
3295
|
+
*
|
|
745
3296
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3297
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3298
|
+
* @example
|
|
3299
|
+
* Platform.Load("core", "1.1.5");
|
|
3300
|
+
* var timezones = DateTime.TimeZone.Retrieve({ Property: "ID", SimpleOperator: "equals", Value: 1 });
|
|
3301
|
+
* Write(Stringify(timezones));
|
|
746
3302
|
*/
|
|
747
3303
|
function Retrieve(filter: object): object[];
|
|
748
3304
|
}
|
|
@@ -750,14 +3306,42 @@ declare namespace DateTime.TimeZone {
|
|
|
750
3306
|
// ── Standalone Core Library globals ──────────────────────────────────────────
|
|
751
3307
|
declare namespace Attribute {
|
|
752
3308
|
/**
|
|
3309
|
+
* Returns the value of the specified subscriber attribute or sendable data extension field for the current recipient. Preferred over Platform.Recipient.GetAttributeValue() — both methods are equivalent.
|
|
3310
|
+
*
|
|
3311
|
+
* [ssjs.guide reference](https://ssjs.guide/global-functions/attribute/)
|
|
3312
|
+
*
|
|
753
3313
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3314
|
+
* @param name - Name of the subscriber attribute or sendable DE field to retrieve.
|
|
3315
|
+
* @example
|
|
3316
|
+
* Platform.Load("core", "1.1.5");
|
|
3317
|
+
* var email = Attribute.GetValue("EmailAddress");
|
|
3318
|
+
* Write(email);
|
|
754
3319
|
*/
|
|
755
3320
|
function GetValue(name: string): string;
|
|
756
3321
|
}
|
|
757
3322
|
|
|
758
3323
|
declare namespace ErrorUtil {
|
|
759
3324
|
/**
|
|
760
|
-
*
|
|
3325
|
+
* Inspects a WSProxy result object and throws an exception when its `Status` property starts with `"Error:"`. WSProxy methods never raise exceptions on SOAP-level errors — instead they return a result object whose `Status` field signals the outcome. Wrap WSProxy calls in a `try`/`catch` block and call this function immediately after each call to convert non-OK results into catchable exceptions.
|
|
3326
|
+
*
|
|
3327
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/errorutil/)
|
|
3328
|
+
*
|
|
3329
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3330
|
+
* @param result - Result object returned by any WSProxy method. Minimum shape: `{ Status: string, RequestID: string, Results: object[] }`. Retrieve and perform variants may include additional fields.
|
|
3331
|
+
* @example
|
|
3332
|
+
* Platform.Load("core", "1.1.5");
|
|
3333
|
+
* var api = new Script.Util.WSProxy();
|
|
3334
|
+
* var customerKey = "0b744ffa-bab5-458d-9e7d-fb05a7873380";
|
|
3335
|
+
* try {
|
|
3336
|
+
* var result = api.retrieve(
|
|
3337
|
+
* "DataExtensionObject[" + customerKey + "]",
|
|
3338
|
+
* ["FirstName", "LastName", "EmailAddress"]
|
|
3339
|
+
* );
|
|
3340
|
+
* ErrorUtil.ThrowWSProxyError(result);
|
|
3341
|
+
* // process successful results
|
|
3342
|
+
* } catch (ex) {
|
|
3343
|
+
* // custom error-handling logic
|
|
3344
|
+
* }
|
|
761
3345
|
*/
|
|
762
3346
|
function ThrowWSProxyError(result: object): void;
|
|
763
3347
|
}
|
|
@@ -765,55 +3349,118 @@ declare namespace ErrorUtil {
|
|
|
765
3349
|
// ── Event namespaces ─────────────────────────────────────────────────────────
|
|
766
3350
|
declare namespace BounceEvent {
|
|
767
3351
|
/**
|
|
3352
|
+
* Retrieves bounce event data for message sends matching the specified filter.
|
|
3353
|
+
*
|
|
768
3354
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3355
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3356
|
+
* @example
|
|
3357
|
+
* Platform.Load("core", "1.1.5");
|
|
3358
|
+
* var bounces = BounceEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3359
|
+
* Write(Stringify(bounces));
|
|
769
3360
|
*/
|
|
770
3361
|
function Retrieve(filter: object): object[];
|
|
771
3362
|
}
|
|
772
3363
|
declare namespace ClickEvent {
|
|
773
3364
|
/**
|
|
3365
|
+
* Retrieves click tracking event data for message sends matching the specified filter.
|
|
3366
|
+
*
|
|
774
3367
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3368
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3369
|
+
* @example
|
|
3370
|
+
* Platform.Load("core", "1.1.5");
|
|
3371
|
+
* var clicks = ClickEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3372
|
+
* Write(Stringify(clicks));
|
|
775
3373
|
*/
|
|
776
3374
|
function Retrieve(filter: object): object[];
|
|
777
3375
|
}
|
|
778
3376
|
declare namespace ForwardedEmailEvent {
|
|
779
3377
|
/**
|
|
3378
|
+
* Retrieves forwarded email event data for message sends matching the specified filter.
|
|
3379
|
+
*
|
|
780
3380
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3381
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3382
|
+
* @example
|
|
3383
|
+
* Platform.Load("core", "1.1.5");
|
|
3384
|
+
* var forwards = ForwardedEmailEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3385
|
+
* Write(Stringify(forwards));
|
|
781
3386
|
*/
|
|
782
3387
|
function Retrieve(filter: object): object[];
|
|
783
3388
|
}
|
|
784
3389
|
declare namespace ForwardedEmailOptInEvent {
|
|
785
3390
|
/**
|
|
3391
|
+
* Retrieves forwarded email opt-in event data for message sends matching the specified filter.
|
|
3392
|
+
*
|
|
786
3393
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3394
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3395
|
+
* @example
|
|
3396
|
+
* Platform.Load("core", "1.1.5");
|
|
3397
|
+
* var optIns = ForwardedEmailOptInEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3398
|
+
* Write(Stringify(optIns));
|
|
787
3399
|
*/
|
|
788
3400
|
function Retrieve(filter: object): object[];
|
|
789
3401
|
}
|
|
790
3402
|
declare namespace NotSentEvent {
|
|
791
3403
|
/**
|
|
3404
|
+
* Retrieves not-sent event data for message sends matching the specified filter.
|
|
3405
|
+
*
|
|
792
3406
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3407
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3408
|
+
* @example
|
|
3409
|
+
* Platform.Load("core", "1.1.5");
|
|
3410
|
+
* var notSent = NotSentEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3411
|
+
* Write(Stringify(notSent));
|
|
793
3412
|
*/
|
|
794
3413
|
function Retrieve(filter: object): object[];
|
|
795
3414
|
}
|
|
796
3415
|
declare namespace OpenEvent {
|
|
797
3416
|
/**
|
|
3417
|
+
* Retrieves open tracking event data for message sends matching the specified filter.
|
|
3418
|
+
*
|
|
798
3419
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3420
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3421
|
+
* @example
|
|
3422
|
+
* Platform.Load("core", "1.1.5");
|
|
3423
|
+
* var opens = OpenEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3424
|
+
* Write(Stringify(opens));
|
|
799
3425
|
*/
|
|
800
3426
|
function Retrieve(filter: object): object[];
|
|
801
3427
|
}
|
|
802
3428
|
declare namespace SentEvent {
|
|
803
3429
|
/**
|
|
3430
|
+
* Retrieves sent event data for message sends matching the specified filter.
|
|
3431
|
+
*
|
|
804
3432
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3433
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3434
|
+
* @example
|
|
3435
|
+
* Platform.Load("core", "1.1.5");
|
|
3436
|
+
* var sent = SentEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3437
|
+
* Write(Stringify(sent));
|
|
805
3438
|
*/
|
|
806
3439
|
function Retrieve(filter: object): object[];
|
|
807
3440
|
}
|
|
808
3441
|
declare namespace SurveyEvent {
|
|
809
3442
|
/**
|
|
3443
|
+
* Retrieves survey response event data for message sends matching the specified filter.
|
|
3444
|
+
*
|
|
810
3445
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3446
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3447
|
+
* @example
|
|
3448
|
+
* Platform.Load("core", "1.1.5");
|
|
3449
|
+
* var surveys = SurveyEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3450
|
+
* Write(Stringify(surveys));
|
|
811
3451
|
*/
|
|
812
3452
|
function Retrieve(filter: object): object[];
|
|
813
3453
|
}
|
|
814
3454
|
declare namespace UnsubEvent {
|
|
815
3455
|
/**
|
|
3456
|
+
* Retrieves unsubscribe event data for message sends matching the specified filter.
|
|
3457
|
+
*
|
|
816
3458
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3459
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3460
|
+
* @example
|
|
3461
|
+
* Platform.Load("core", "1.1.5");
|
|
3462
|
+
* var unsubs = UnsubEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3463
|
+
* Write(Stringify(unsubs));
|
|
817
3464
|
*/
|
|
818
3465
|
function Retrieve(filter: object): object[];
|
|
819
3466
|
}
|
|
@@ -821,26 +3468,76 @@ declare namespace UnsubEvent {
|
|
|
821
3468
|
// ── HTTP / HTTPHeader ────────────────────────────────────────────────────────
|
|
822
3469
|
declare namespace HTTP {
|
|
823
3470
|
/**
|
|
3471
|
+
* Performs an HTTP GET request and returns the response body. When supplying `headerNames` and `headerValues`, both arrays must have equal length and parallel ordering.
|
|
3472
|
+
*
|
|
3473
|
+
* [ssjs.guide reference](https://ssjs.guide/http/get/)
|
|
3474
|
+
*
|
|
824
3475
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3476
|
+
* @param url - URL to request.
|
|
3477
|
+
* @param headerNames - Array of header names (co-required with headerValues).
|
|
3478
|
+
* @param headerValues - Array of header values, one per entry in headerNames (co-required).
|
|
3479
|
+
* @example
|
|
3480
|
+
* Platform.Load("core", "1.1.5");
|
|
3481
|
+
* var body = HTTP.Get("https://api.example.com/data");
|
|
3482
|
+
* var obj = Platform.Function.ParseJSON(String(body));
|
|
825
3483
|
*/
|
|
826
3484
|
function Get(url: string, headerNames?: any[], headerValues?: any[]): object;
|
|
827
3485
|
/**
|
|
828
|
-
*
|
|
3486
|
+
* Performs an HTTP POST request with a content type and payload. Pass empty arrays for `headerNames` and `headerValues` if no custom headers are needed.
|
|
3487
|
+
*
|
|
3488
|
+
* [ssjs.guide reference](https://ssjs.guide/http/post/)
|
|
3489
|
+
*
|
|
3490
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3491
|
+
* @param url - URL to post to.
|
|
3492
|
+
* @param contentType - MIME type of the request body.
|
|
3493
|
+
* @param payload - Request body content.
|
|
3494
|
+
* @param headerNames - Array of header names to include in the request.
|
|
3495
|
+
* @param headerValues - Array of header values, one per entry in headerNames.
|
|
3496
|
+
* @example
|
|
3497
|
+
* Platform.Load("core", "1.1.5");
|
|
3498
|
+
* var payload = Stringify({ email: "jane@example.com" });
|
|
3499
|
+
* var response = HTTP.Post("https://api.example.com/items", "application/json", payload);
|
|
829
3500
|
*/
|
|
830
3501
|
function Post(url: string, contentType: string, payload: string, headerNames: string[], headerValues: any[]): object;
|
|
831
3502
|
}
|
|
832
3503
|
|
|
833
3504
|
declare namespace HTTPHeader {
|
|
834
3505
|
/**
|
|
3506
|
+
* Retrieves the value of the specified HTTP request header.
|
|
3507
|
+
*
|
|
3508
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/httpheader/)
|
|
3509
|
+
*
|
|
835
3510
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3511
|
+
* @param name - Name of the HTTP header to read
|
|
3512
|
+
* @example
|
|
3513
|
+
* Platform.Load("core", "1");
|
|
3514
|
+
* var from = HTTPHeader.GetValue("From");
|
|
3515
|
+
* Write(from);
|
|
836
3516
|
*/
|
|
837
3517
|
function GetValue(name: string): string;
|
|
838
3518
|
/**
|
|
3519
|
+
* Sets the value of the specified HTTP header. The host and content-length headers cannot be changed.
|
|
3520
|
+
*
|
|
3521
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/httpheader/)
|
|
3522
|
+
*
|
|
839
3523
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3524
|
+
* @param name - Name of the header to set
|
|
3525
|
+
* @param value - Value to assign to the header
|
|
3526
|
+
* @example
|
|
3527
|
+
* Platform.Load("core", "1");
|
|
3528
|
+
* HTTPHeader.SetValue("From", "aruiz@example.com");
|
|
840
3529
|
*/
|
|
841
3530
|
function SetValue(name: string, value: string): void;
|
|
842
3531
|
/**
|
|
3532
|
+
* Removes the specified entry from the HTTP header.
|
|
3533
|
+
*
|
|
3534
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/httpheader/)
|
|
3535
|
+
*
|
|
843
3536
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3537
|
+
* @param headerName - Name of the header to remove
|
|
3538
|
+
* @example
|
|
3539
|
+
* Platform.Load("core", "1");
|
|
3540
|
+
* var result = HTTPHeader.Remove("From"); // returns "OK"
|
|
844
3541
|
*/
|
|
845
3542
|
function Remove(headerName: string): string;
|
|
846
3543
|
}
|
|
@@ -850,34 +3547,368 @@ declare namespace Script {
|
|
|
850
3547
|
namespace Util {
|
|
851
3548
|
class WSProxy {
|
|
852
3549
|
constructor();
|
|
3550
|
+
/**
|
|
3551
|
+
* Creates a new Marketing Cloud object via the SOAP API.
|
|
3552
|
+
*
|
|
3553
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/createitem/)
|
|
3554
|
+
*
|
|
3555
|
+
* @param objectType - SOAP API object type name
|
|
3556
|
+
* @param properties - Object properties to set
|
|
3557
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3558
|
+
* @example
|
|
3559
|
+
* var api = new Script.Util.WSProxy();
|
|
3560
|
+
* var result = api.createItem("DataExtensionObject", {
|
|
3561
|
+
* CustomerKey: "MyDE",
|
|
3562
|
+
* Properties: { Property: [{ Name: "Email", Value: "jane@example.com" }] }
|
|
3563
|
+
* });
|
|
3564
|
+
* if (result.Status === "OK") { Write("Created"); }
|
|
3565
|
+
*/
|
|
853
3566
|
createItem(objectType: string, properties: object): object;
|
|
3567
|
+
/**
|
|
3568
|
+
* Updates an existing Marketing Cloud object via the SOAP API.
|
|
3569
|
+
*
|
|
3570
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/updateitem/)
|
|
3571
|
+
*
|
|
3572
|
+
* @param objectType - SOAP API object type name
|
|
3573
|
+
* @param properties - Object properties to update
|
|
3574
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3575
|
+
* @example
|
|
3576
|
+
* var api = new Script.Util.WSProxy();
|
|
3577
|
+
* var result = api.updateItem("DataExtensionObject", {
|
|
3578
|
+
* CustomerKey: "MyDE",
|
|
3579
|
+
* Properties: { Property: [{ Name: "Status", Value: "inactive" }] }
|
|
3580
|
+
* });
|
|
3581
|
+
* if (result.Status === "OK") { Write("Updated"); }
|
|
3582
|
+
*/
|
|
854
3583
|
updateItem(objectType: string, properties: object): object;
|
|
3584
|
+
/**
|
|
3585
|
+
* Deletes a Marketing Cloud object via the SOAP API.
|
|
3586
|
+
*
|
|
3587
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/deleteitem/)
|
|
3588
|
+
*
|
|
3589
|
+
* @param objectType - SOAP API object type name
|
|
3590
|
+
* @param properties - Object properties identifying the item to delete
|
|
3591
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3592
|
+
* @example
|
|
3593
|
+
* var api = new Script.Util.WSProxy();
|
|
3594
|
+
* var result = api.deleteItem("DataExtensionObject", {
|
|
3595
|
+
* CustomerKey: "MyDE",
|
|
3596
|
+
* Keys: { Key: [{ Name: "Email", Value: "jane@example.com" }] }
|
|
3597
|
+
* });
|
|
3598
|
+
* if (result.Status === "OK") { Write("Deleted"); }
|
|
3599
|
+
*/
|
|
855
3600
|
deleteItem(objectType: string, properties: object): object;
|
|
3601
|
+
/**
|
|
3602
|
+
* Retrieves Marketing Cloud objects matching an optional filter via the SOAP API. The third parameter is a simple or complex filter; the fourth sets RetrieveOptions; the fifth sets additional request properties such as QueryAllAccounts.
|
|
3603
|
+
*
|
|
3604
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/retrieve/)
|
|
3605
|
+
*
|
|
3606
|
+
* @param objectType - SOAP API object type name
|
|
3607
|
+
* @param columns - Array of property names to retrieve
|
|
3608
|
+
* @param filter - Simple or complex filter object
|
|
3609
|
+
* @param retrieveOptions - Properties to set on the SOAP RetrieveOptions object
|
|
3610
|
+
* @param requestProps - Additional request properties (e.g. QueryAllAccounts)
|
|
3611
|
+
* @returns Object with Status, HasMoreRows, RequestID, and Results array.
|
|
3612
|
+
* @example
|
|
3613
|
+
* var api = new Script.Util.WSProxy();
|
|
3614
|
+
* var cols = ["Name", "CustomerKey", "Status"];
|
|
3615
|
+
* var filter = {
|
|
3616
|
+
* Property: "Status",
|
|
3617
|
+
* SimpleOperator: "equals",
|
|
3618
|
+
* Value: "Active"
|
|
3619
|
+
* };
|
|
3620
|
+
* var result = api.retrieve("DataExtension", cols, filter);
|
|
3621
|
+
* if (result.Status === "OK") {
|
|
3622
|
+
* var rows = result.Results;
|
|
3623
|
+
* for (var i = 0; i < rows.length; i++) {
|
|
3624
|
+
* Write(rows[i].Name + "<br>");
|
|
3625
|
+
* }
|
|
3626
|
+
* }
|
|
3627
|
+
*/
|
|
856
3628
|
retrieve(objectType: string, columns: any[], filter?: object, retrieveOptions?: object, requestProps?: object): object;
|
|
3629
|
+
/**
|
|
3630
|
+
* Retrieves the next page of results from a previous retrieve call that returned HasMoreRows = true.
|
|
3631
|
+
*
|
|
3632
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/getnextbatch/)
|
|
3633
|
+
*
|
|
3634
|
+
* @param objectType - SOAP API object type name used in the original retrieve call
|
|
3635
|
+
* @param requestId - RequestID returned by the previous retrieve response
|
|
3636
|
+
* @returns Object with Status, HasMoreRows, RequestID, and Results array.
|
|
3637
|
+
* @example
|
|
3638
|
+
* var api = new Script.Util.WSProxy();
|
|
3639
|
+
* var result = api.retrieve("DataExtension", ["Name"], {});
|
|
3640
|
+
* while (result.HasMoreRows) {
|
|
3641
|
+
* result = api.getNextBatch("DataExtension", result.RequestID);
|
|
3642
|
+
* for (var i = 0; i < result.Results.length; i++) {
|
|
3643
|
+
* Write(result.Results[i].Name + "<br>");
|
|
3644
|
+
* }
|
|
3645
|
+
* }
|
|
3646
|
+
*/
|
|
857
3647
|
getNextBatch(objectType: string, requestId: string): object;
|
|
3648
|
+
/**
|
|
3649
|
+
* Executes a perform action on a single Marketing Cloud object.
|
|
3650
|
+
*
|
|
3651
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/perform/)
|
|
3652
|
+
*
|
|
3653
|
+
* @param objectType - SOAP API object type name.
|
|
3654
|
+
* @param properties - Object properties identifying the target item (e.g. { ObjectID: "..." }).
|
|
3655
|
+
* @param action - Action to perform. Only "Start" is valid (lowercase "start" fails).
|
|
3656
|
+
* @param performOptions - Properties of the SOAP PerformOptions object.
|
|
3657
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3658
|
+
* @example
|
|
3659
|
+
* var api = new Script.Util.WSProxy();
|
|
3660
|
+
* var result = api.performItem("QueryDefinition", { ObjectID: queryObjectId }, "Start");
|
|
3661
|
+
* Write(result.Status);
|
|
3662
|
+
*/
|
|
858
3663
|
performItem(objectType: string, properties: object, action: string, performOptions?: object): object;
|
|
3664
|
+
/**
|
|
3665
|
+
* Executes a perform action on multiple Marketing Cloud objects in a single SOAP API call.
|
|
3666
|
+
*
|
|
3667
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/performbatch/)
|
|
3668
|
+
*
|
|
3669
|
+
* @param objectType - SOAP API object type name
|
|
3670
|
+
* @param propertiesArray - Array of property objects identifying the target items
|
|
3671
|
+
* @param action - Action to perform. Only "Start" is valid (lowercase "start" fails).
|
|
3672
|
+
* @param performOptions - Properties of the SOAP PerformOptions object
|
|
3673
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3674
|
+
* @example
|
|
3675
|
+
* var api = new Script.Util.WSProxy();
|
|
3676
|
+
* var items = [{ ObjectID: id1 }, { ObjectID: id2 }];
|
|
3677
|
+
* var result = api.performBatch("QueryDefinition", items, "Start");
|
|
3678
|
+
* Write(result.Status);
|
|
3679
|
+
*/
|
|
859
3680
|
performBatch(objectType: string, propertiesArray: any[], action: string, performOptions?: object): object;
|
|
3681
|
+
/**
|
|
3682
|
+
* Returns structural metadata (ObjectDefinition) for one or more SOAP API object types.
|
|
3683
|
+
*
|
|
3684
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/describe/)
|
|
3685
|
+
*
|
|
3686
|
+
* @param objectType - Object type name or array of type names to describe
|
|
3687
|
+
* @returns Object with Status and Results array containing ObjectDefinition entries.
|
|
3688
|
+
* @example
|
|
3689
|
+
* var api = new Script.Util.WSProxy();
|
|
3690
|
+
* var result = api.describe("DataExtension");
|
|
3691
|
+
* Write(Stringify(result.Results));
|
|
3692
|
+
*/
|
|
860
3693
|
describe(objectType: string): object;
|
|
3694
|
+
/**
|
|
3695
|
+
* Executes a named method on a Marketing Cloud object.
|
|
3696
|
+
*
|
|
3697
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/execute/)
|
|
3698
|
+
*
|
|
3699
|
+
* @param objectType - SOAP API object type name.
|
|
3700
|
+
* @param requestName - Name of the request to execute.
|
|
3701
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3702
|
+
* @example
|
|
3703
|
+
* var api = new Script.Util.WSProxy();
|
|
3704
|
+
* var result = api.execute("DataExtensionObject", "LogUnsubEvent");
|
|
3705
|
+
* Write(result.Status);
|
|
3706
|
+
*/
|
|
861
3707
|
execute(objectType: string, requestName: string): object;
|
|
3708
|
+
/**
|
|
3709
|
+
* Sets the maximum number of objects returned per SOAP API page (default is 2500).
|
|
3710
|
+
*
|
|
3711
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/setbatchsize/)
|
|
3712
|
+
*
|
|
3713
|
+
* @param batchSize - Maximum number of objects per batch
|
|
3714
|
+
* @example
|
|
3715
|
+
* var api = new Script.Util.WSProxy();
|
|
3716
|
+
* api.setBatchSize(200);
|
|
3717
|
+
* var result = api.retrieve("DataExtension", ["Name"], {});
|
|
3718
|
+
*/
|
|
862
3719
|
setBatchSize(batchSize: number): void;
|
|
3720
|
+
/**
|
|
3721
|
+
* Sets the business unit MID for cross-account operations.
|
|
3722
|
+
*
|
|
3723
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/setclientid/)
|
|
3724
|
+
*
|
|
3725
|
+
* @param clientId - Object containing the MID of the target business unit
|
|
3726
|
+
* @example
|
|
3727
|
+
* var api = new Script.Util.WSProxy();
|
|
3728
|
+
* api.setClientId({ ID: 12345 }); // target child BU by MID
|
|
3729
|
+
* var result = api.retrieve("DataExtension", ["Name"], {});
|
|
3730
|
+
*/
|
|
863
3731
|
setClientId(clientId: object): void;
|
|
3732
|
+
/**
|
|
3733
|
+
* Clears all client IDs set on the WSProxy instance, reverting to the default execution context credentials.
|
|
3734
|
+
*
|
|
3735
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/resetclientids/)
|
|
3736
|
+
*
|
|
3737
|
+
* @example
|
|
3738
|
+
* var api = new Script.Util.WSProxy();
|
|
3739
|
+
* api.setClientId({ ID: 12345 });
|
|
3740
|
+
* // ... perform cross-BU operations ...
|
|
3741
|
+
* api.resetClientIds(); // revert to default context
|
|
3742
|
+
* var result = api.retrieve("DataExtension", ["Name"], {});
|
|
3743
|
+
*/
|
|
864
3744
|
resetClientIds(): void;
|
|
3745
|
+
/**
|
|
3746
|
+
* Creates multiple Marketing Cloud objects in a single SOAP API call.
|
|
3747
|
+
*
|
|
3748
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/createbatch/)
|
|
3749
|
+
*
|
|
3750
|
+
* @param objectType - SOAP API object type name
|
|
3751
|
+
* @param propertiesArray - Array of property objects to create
|
|
3752
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3753
|
+
* @example
|
|
3754
|
+
* var api = new Script.Util.WSProxy();
|
|
3755
|
+
* var items = [
|
|
3756
|
+
* { CustomerKey: "MyDE", Properties: { Property: [{ Name: "Email", Value: "a@example.com" }] } },
|
|
3757
|
+
* { CustomerKey: "MyDE", Properties: { Property: [{ Name: "Email", Value: "b@example.com" }] } }
|
|
3758
|
+
* ];
|
|
3759
|
+
* var result = api.createBatch("DataExtensionObject", items);
|
|
3760
|
+
* Write(result.Status);
|
|
3761
|
+
*/
|
|
865
3762
|
createBatch(objectType: string, propertiesArray: any[]): object;
|
|
3763
|
+
/**
|
|
3764
|
+
* Updates multiple Marketing Cloud objects in a single SOAP API call.
|
|
3765
|
+
*
|
|
3766
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/updatebatch/)
|
|
3767
|
+
*
|
|
3768
|
+
* @param objectType - SOAP API object type name
|
|
3769
|
+
* @param propertiesArray - Array of property objects to update
|
|
3770
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3771
|
+
* @example
|
|
3772
|
+
* var api = new Script.Util.WSProxy();
|
|
3773
|
+
* var items = [
|
|
3774
|
+
* { CustomerKey: "MyDE", Keys: { Key: [{ Name: "Email", Value: "a@example.com" }] }, Properties: { Property: [{ Name: "Status", Value: "active" }] } }
|
|
3775
|
+
* ];
|
|
3776
|
+
* var result = api.updateBatch("DataExtensionObject", items);
|
|
3777
|
+
* Write(result.Status);
|
|
3778
|
+
*/
|
|
866
3779
|
updateBatch(objectType: string, propertiesArray: any[]): object;
|
|
3780
|
+
/**
|
|
3781
|
+
* Deletes multiple Marketing Cloud objects in a single SOAP API call.
|
|
3782
|
+
*
|
|
3783
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/deletebatch/)
|
|
3784
|
+
*
|
|
3785
|
+
* @param objectType - SOAP API object type name
|
|
3786
|
+
* @param propertiesArray - Array of property objects to delete
|
|
3787
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3788
|
+
* @example
|
|
3789
|
+
* var api = new Script.Util.WSProxy();
|
|
3790
|
+
* var items = [
|
|
3791
|
+
* { CustomerKey: "MyDE", Keys: { Key: [{ Name: "Email", Value: "old@example.com" }] } }
|
|
3792
|
+
* ];
|
|
3793
|
+
* var result = api.deleteBatch("DataExtensionObject", items);
|
|
3794
|
+
* Write(result.Status);
|
|
3795
|
+
*/
|
|
867
3796
|
deleteBatch(objectType: string, propertiesArray: any[]): object;
|
|
868
3797
|
}
|
|
869
3798
|
class HttpRequest {
|
|
870
3799
|
constructor(url: string);
|
|
3800
|
+
/**
|
|
3801
|
+
* Executes the HTTP request and returns a Script.Util.HttpResponse object. The response object has a `statusCode` property and a `content` property. Use String(resp.content) to convert the CLR content to a JavaScript string before parsing with Platform.Function.ParseJSON().
|
|
3802
|
+
*
|
|
3803
|
+
* [ssjs.guide reference](https://ssjs.guide/http/request-methods/)
|
|
3804
|
+
*
|
|
3805
|
+
* @example
|
|
3806
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
3807
|
+
* req.method = "GET";
|
|
3808
|
+
* req.setHeader("Authorization", "Bearer " + accessToken);
|
|
3809
|
+
* var resp = req.send();
|
|
3810
|
+
* if (resp.statusCode == 200) {
|
|
3811
|
+
* var result = Platform.Function.ParseJSON(String(resp.content));
|
|
3812
|
+
* }
|
|
3813
|
+
*/
|
|
871
3814
|
send(): object;
|
|
3815
|
+
/**
|
|
3816
|
+
* Sets a request header on the Script.Util HTTP request. Note: setting a custom header disables content caching for Script.Util.HttpGet.
|
|
3817
|
+
*
|
|
3818
|
+
* [ssjs.guide reference](https://ssjs.guide/http/request-methods/)
|
|
3819
|
+
*
|
|
3820
|
+
* @param name - Header name (e.g. "Authorization", "Content-Type")
|
|
3821
|
+
* @param value - Header value
|
|
3822
|
+
* @example
|
|
3823
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
3824
|
+
* req.setHeader("Authorization", "Bearer " + accessToken);
|
|
3825
|
+
* req.setHeader("Content-Type", "application/json");
|
|
3826
|
+
* var resp = req.send();
|
|
3827
|
+
*/
|
|
872
3828
|
setHeader(name: string, value: string): void;
|
|
3829
|
+
/**
|
|
3830
|
+
* Removes all custom headers previously set on the request.
|
|
3831
|
+
*
|
|
3832
|
+
* [ssjs.guide reference](https://ssjs.guide/http/request-methods/)
|
|
3833
|
+
*
|
|
3834
|
+
* @example
|
|
3835
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
3836
|
+
* req.setHeader("Authorization", "Bearer " + accessToken);
|
|
3837
|
+
* req.clearHeaders(); // removes Authorization and all other custom headers
|
|
3838
|
+
* var resp = req.send();
|
|
3839
|
+
*/
|
|
873
3840
|
clearHeaders(): void;
|
|
3841
|
+
/**
|
|
3842
|
+
* Removes a specific header from the request by name.
|
|
3843
|
+
*
|
|
3844
|
+
* [ssjs.guide reference](https://ssjs.guide/http/request-methods/)
|
|
3845
|
+
*
|
|
3846
|
+
* @param name - Name of the header to remove
|
|
3847
|
+
* @example
|
|
3848
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
3849
|
+
* req.setHeader("Authorization", "Bearer " + accessToken);
|
|
3850
|
+
* req.setHeader("X-Custom", "value");
|
|
3851
|
+
* req.removeHeader("X-Custom");
|
|
3852
|
+
* var resp = req.send();
|
|
3853
|
+
*/
|
|
874
3854
|
removeHeader(name: string): void;
|
|
875
3855
|
}
|
|
876
3856
|
class HttpGet {
|
|
877
3857
|
constructor(url: string);
|
|
3858
|
+
/**
|
|
3859
|
+
* Executes the HTTP request and returns a Script.Util.HttpResponse object. The response object has a `statusCode` property and a `content` property. Use String(resp.content) to convert the CLR content to a JavaScript string before parsing with Platform.Function.ParseJSON().
|
|
3860
|
+
*
|
|
3861
|
+
* [ssjs.guide reference](https://ssjs.guide/http/request-methods/)
|
|
3862
|
+
*
|
|
3863
|
+
* @example
|
|
3864
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
3865
|
+
* req.method = "GET";
|
|
3866
|
+
* req.setHeader("Authorization", "Bearer " + accessToken);
|
|
3867
|
+
* var resp = req.send();
|
|
3868
|
+
* if (resp.statusCode == 200) {
|
|
3869
|
+
* var result = Platform.Function.ParseJSON(String(resp.content));
|
|
3870
|
+
* }
|
|
3871
|
+
*/
|
|
878
3872
|
send(): object;
|
|
3873
|
+
/**
|
|
3874
|
+
* Sets a request header on the Script.Util HTTP request. Note: setting a custom header disables content caching for Script.Util.HttpGet.
|
|
3875
|
+
*
|
|
3876
|
+
* [ssjs.guide reference](https://ssjs.guide/http/request-methods/)
|
|
3877
|
+
*
|
|
3878
|
+
* @param name - Header name (e.g. "Authorization", "Content-Type")
|
|
3879
|
+
* @param value - Header value
|
|
3880
|
+
* @example
|
|
3881
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
3882
|
+
* req.setHeader("Authorization", "Bearer " + accessToken);
|
|
3883
|
+
* req.setHeader("Content-Type", "application/json");
|
|
3884
|
+
* var resp = req.send();
|
|
3885
|
+
*/
|
|
879
3886
|
setHeader(name: string, value: string): void;
|
|
3887
|
+
/**
|
|
3888
|
+
* Removes all custom headers previously set on the request.
|
|
3889
|
+
*
|
|
3890
|
+
* [ssjs.guide reference](https://ssjs.guide/http/request-methods/)
|
|
3891
|
+
*
|
|
3892
|
+
* @example
|
|
3893
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
3894
|
+
* req.setHeader("Authorization", "Bearer " + accessToken);
|
|
3895
|
+
* req.clearHeaders(); // removes Authorization and all other custom headers
|
|
3896
|
+
* var resp = req.send();
|
|
3897
|
+
*/
|
|
880
3898
|
clearHeaders(): void;
|
|
3899
|
+
/**
|
|
3900
|
+
* Removes a specific header from the request by name.
|
|
3901
|
+
*
|
|
3902
|
+
* [ssjs.guide reference](https://ssjs.guide/http/request-methods/)
|
|
3903
|
+
*
|
|
3904
|
+
* @param name - Name of the header to remove
|
|
3905
|
+
* @example
|
|
3906
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
3907
|
+
* req.setHeader("Authorization", "Bearer " + accessToken);
|
|
3908
|
+
* req.setHeader("X-Custom", "value");
|
|
3909
|
+
* req.removeHeader("X-Custom");
|
|
3910
|
+
* var resp = req.send();
|
|
3911
|
+
*/
|
|
881
3912
|
removeHeader(name: string): void;
|
|
882
3913
|
}
|
|
883
3914
|
}
|
|
@@ -917,12 +3948,45 @@ interface String {
|
|
|
917
3948
|
}
|
|
918
3949
|
|
|
919
3950
|
interface Number {
|
|
3951
|
+
/**
|
|
3952
|
+
* Returns a string representing the number in fixed-point notation with the given number of decimal places.
|
|
3953
|
+
*
|
|
3954
|
+
* @param fractionDigits - Number of digits after the decimal point (0–20, default 0)
|
|
3955
|
+
* @example
|
|
3956
|
+
* var price = 9.99;
|
|
3957
|
+
* Write(price.toFixed(2)); // "9.99"
|
|
3958
|
+
* Write((1.5).toFixed(0)); // "2"
|
|
3959
|
+
*/
|
|
920
3960
|
toFixed(fractionDigits?: number): string;
|
|
3961
|
+
/**
|
|
3962
|
+
* Returns a string representing the number in exponential notation. If fractionDigits is omitted, enough digits are included to uniquely identify the value.
|
|
3963
|
+
*
|
|
3964
|
+
* @param fractionDigits - Digits after the decimal point in the significand (0–20)
|
|
3965
|
+
* @example
|
|
3966
|
+
* Write((123456).toExponential(2)); // "1.23e+5"
|
|
3967
|
+
*/
|
|
921
3968
|
toExponential(fractionDigits?: number): string;
|
|
3969
|
+
/**
|
|
3970
|
+
* Returns a string representing the number to the specified number of significant digits.
|
|
3971
|
+
*
|
|
3972
|
+
* @param precision - Number of significant digits (1–21)
|
|
3973
|
+
* @example
|
|
3974
|
+
* Write((123.456).toPrecision(5)); // "123.46"
|
|
3975
|
+
*/
|
|
922
3976
|
toPrecision(precision?: number): string;
|
|
923
3977
|
}
|
|
924
3978
|
|
|
925
3979
|
interface Object {
|
|
3980
|
+
/**
|
|
3981
|
+
* Returns true if the object has the specified property as its own (not inherited) property. Commonly used to safely iterate for...in loops.
|
|
3982
|
+
*
|
|
3983
|
+
* @param v - Property name to test
|
|
3984
|
+
* @example
|
|
3985
|
+
* var obj = {a: 1};
|
|
3986
|
+
* for (var key in obj) {
|
|
3987
|
+
* if (obj.hasOwnProperty(key)) { Write(key); }
|
|
3988
|
+
* }
|
|
3989
|
+
*/
|
|
926
3990
|
hasOwnProperty(v?: string): boolean;
|
|
927
3991
|
}
|
|
928
3992
|
|