ssjs-data 0.3.1 → 0.3.3
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 +3554 -4
- package/dist/site-index.json +3512 -0
- package/package.json +6 -2
- package/src/index.js +14 -1
- package/src/urls.js +203 -0
package/dist/sfmc-globals.d.ts
CHANGED
|
@@ -5,79 +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;
|
|
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
|
+
*
|
|
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");
|
|
718
|
+
*/
|
|
57
719
|
function ContentArea(id: number, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
|
|
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
|
+
*
|
|
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");
|
|
733
|
+
*/
|
|
58
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
|
+
*/
|
|
59
747
|
function IsCHTMLBrowser(userAgentString: string): boolean;
|
|
60
748
|
}
|
|
61
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
|
+
*/
|
|
62
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
|
+
*/
|
|
63
774
|
function SetValue(variableName: string, value: string): void;
|
|
64
775
|
}
|
|
65
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
|
+
*/
|
|
66
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
|
+
*/
|
|
67
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
|
+
*/
|
|
68
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
|
+
*/
|
|
69
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
|
+
*/
|
|
70
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
|
+
*/
|
|
71
843
|
function Write(content: string): void;
|
|
72
844
|
var ContentType: string;
|
|
73
845
|
var CharacterSet: string;
|
|
74
846
|
}
|
|
75
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
|
+
*/
|
|
76
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
|
+
*/
|
|
77
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
|
+
*/
|
|
78
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
|
+
*/
|
|
79
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
|
+
*/
|
|
80
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
|
+
*/
|
|
81
914
|
function GetRequestHeader(headerName: string): string;
|
|
82
915
|
const Browser: object;
|
|
83
916
|
const ClientIP: string;
|
|
@@ -90,273 +923,2623 @@ declare namespace Platform {
|
|
|
90
923
|
const UserAgent: string;
|
|
91
924
|
}
|
|
92
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
|
+
*/
|
|
93
936
|
function GetAttributeValue(attributeName: string): string;
|
|
94
937
|
}
|
|
95
938
|
}
|
|
96
939
|
|
|
97
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
|
+
|
|
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
|
+
*
|
|
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");
|
|
1156
|
+
*/
|
|
98
1157
|
declare function ContentArea(id: number, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
|
|
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
|
+
*
|
|
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");
|
|
1171
|
+
*/
|
|
99
1172
|
declare function ContentAreaByName(name: string, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
|
|
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
|
+
*
|
|
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();
|
|
1184
|
+
*/
|
|
100
1185
|
declare function BeginImpressionRegion(name: string): void;
|
|
1186
|
+
/**
|
|
1187
|
+
* Marks the end of an impression tracking region within content.
|
|
1188
|
+
*
|
|
1189
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/endimpressionregion/)
|
|
1190
|
+
*
|
|
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();
|
|
1197
|
+
*/
|
|
101
1198
|
declare function EndImpressionRegion(closeAll?: boolean): void;
|
|
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
|
+
*
|
|
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);
|
|
1212
|
+
*/
|
|
102
1213
|
declare function Now(useContextTime?: boolean): string;
|
|
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
|
+
*
|
|
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);
|
|
1225
|
+
*/
|
|
103
1226
|
declare function SystemDateToLocalDate(dateValue: string): string;
|
|
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
|
+
*
|
|
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);
|
|
1238
|
+
*/
|
|
104
1239
|
declare function LocalDateToSystemDate(dateValue: string): string;
|
|
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
|
+
*
|
|
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);
|
|
1250
|
+
*/
|
|
105
1251
|
declare function Redirect(url: string, movedPermanently: boolean): void;
|
|
1252
|
+
/**
|
|
1253
|
+
* Generates a new globally unique identifier string.
|
|
1254
|
+
*
|
|
1255
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/guid/)
|
|
1256
|
+
*
|
|
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"
|
|
1261
|
+
*/
|
|
106
1262
|
declare function GUID(): string;
|
|
1263
|
+
/**
|
|
1264
|
+
* Checks whether a string is a valid email address format.
|
|
1265
|
+
*
|
|
1266
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/isemailaddress/)
|
|
1267
|
+
*
|
|
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
|
+
* }
|
|
1276
|
+
*/
|
|
107
1277
|
declare function IsEmailAddress(value: string): boolean;
|
|
1278
|
+
/**
|
|
1279
|
+
* Evaluates whether a string contains a valid phone number.
|
|
1280
|
+
*
|
|
1281
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/isphonenumber/)
|
|
1282
|
+
*
|
|
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
|
+
* }
|
|
1291
|
+
*/
|
|
108
1292
|
declare function IsPhoneNumber(value: string): boolean;
|
|
1293
|
+
/**
|
|
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
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1299
|
+
* @param content - Content string to write to the response.
|
|
1300
|
+
* @example
|
|
1301
|
+
* var data = { name: "Jane", status: "active" };
|
|
1302
|
+
* Platform.Response.Write(Stringify(data));
|
|
1303
|
+
*/
|
|
109
1304
|
declare function Write(content: string): void;
|
|
1305
|
+
/**
|
|
1306
|
+
* 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.
|
|
1307
|
+
*
|
|
1308
|
+
* [ssjs.guide reference](https://ssjs.guide/global-functions/stringify/)
|
|
1309
|
+
*
|
|
1310
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1311
|
+
* @param object - JavaScript object to serialize to JSON.
|
|
1312
|
+
* @returns JSON string representation of the object.
|
|
1313
|
+
* @example
|
|
1314
|
+
* var json = Platform.Function.Stringify({ name: "Jane", age: 30 });
|
|
1315
|
+
* Platform.Function.Write(json);
|
|
1316
|
+
*/
|
|
110
1317
|
declare function Stringify(object: object): string;
|
|
111
1318
|
|
|
112
1319
|
// ── DataExtension instance interfaces ───────────────────────────────────────
|
|
113
|
-
interface
|
|
1320
|
+
interface DataExtensionFields {
|
|
1321
|
+
/**
|
|
1322
|
+
* 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'.
|
|
1323
|
+
*
|
|
1324
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1325
|
+
* @param properties - Object describing the new field.
|
|
1326
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1327
|
+
* @example
|
|
1328
|
+
* Platform.Load("core", "1.1.5");
|
|
1329
|
+
* var de = DataExtension.Init("SSJSTest");
|
|
1330
|
+
* var newField = { Name: "NewFieldV2", CustomerKey: "CustomerKey", FieldType: "Number", IsRequired: true, DefaultValue: "100" };
|
|
1331
|
+
* var status = de.Fields.Add(newField);
|
|
1332
|
+
*/
|
|
114
1333
|
Add(properties: object): string;
|
|
1334
|
+
/**
|
|
1335
|
+
* Returns an array of field definitions for the previously initialized data extension.
|
|
1336
|
+
*
|
|
1337
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1338
|
+
* @returns List of field-definition objects.
|
|
1339
|
+
* @example
|
|
1340
|
+
* Platform.Load("core", "1.1.5");
|
|
1341
|
+
* var birthdayDE = DataExtension.Init("birthdayDE");
|
|
1342
|
+
* var fields = birthdayDE.Fields.Retrieve();
|
|
1343
|
+
*/
|
|
115
1344
|
Retrieve(): object[];
|
|
1345
|
+
/**
|
|
1346
|
+
* 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.
|
|
1347
|
+
*
|
|
1348
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1349
|
+
* @param deFieldName - Name of the data extension field that should make the connection to the subscriber list.
|
|
1350
|
+
* @param subscriberField - Subscriber attribute to map the data extension field to.
|
|
1351
|
+
* @returns Returns "OK" on success or throws on failure (assumed; doc has no `@returns`, treated as `"OK"` for consistency with sibling `Fields.*` methods).
|
|
1352
|
+
* @example
|
|
1353
|
+
* Platform.Load("core", "1.1.5");
|
|
1354
|
+
* var updateDE = DataExtension.Init("sendableDataExtension");
|
|
1355
|
+
* var status = updateDE.Fields.UpdateSendableField("DifferentSubKey", "Subscriber Key");
|
|
1356
|
+
*/
|
|
116
1357
|
UpdateSendableField(deFieldName: string, subscriberField: string): string;
|
|
117
1358
|
}
|
|
118
|
-
interface
|
|
1359
|
+
interface DataExtensionRows {
|
|
1360
|
+
/**
|
|
1361
|
+
* Adds one or more rows to the previously initialized data extension.
|
|
1362
|
+
*
|
|
1363
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1364
|
+
* @param rowData - Array of objects, one per row to add. Each object's keys must match data extension field names.
|
|
1365
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1366
|
+
* @example
|
|
1367
|
+
* Platform.Load("core", "1.1.5");
|
|
1368
|
+
* var arrContacts = [
|
|
1369
|
+
* { Email: "jdoe@example.com", FirstName: "John", LastName: "Doe" },
|
|
1370
|
+
* { Email: "aruiz@example.com", FirstName: "Angel", LastName: "Ruiz" }
|
|
1371
|
+
* ];
|
|
1372
|
+
* var birthdayDE = DataExtension.Init("birthdayDE");
|
|
1373
|
+
* birthdayDE.Rows.Add(arrContacts);
|
|
1374
|
+
*/
|
|
119
1375
|
Add(rowData: any[]): string;
|
|
1376
|
+
/**
|
|
1377
|
+
* 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.
|
|
1378
|
+
*
|
|
1379
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1380
|
+
* @param searchFieldNames - Array of column names to match against.
|
|
1381
|
+
* @param searchValues - Array of values to match (one per column, in order).
|
|
1382
|
+
* @param limit - Maximum number of rows to return.
|
|
1383
|
+
* @param orderByFieldName - Field to order results by.
|
|
1384
|
+
* @returns Rows matching the lookup criteria.
|
|
1385
|
+
* @example
|
|
1386
|
+
* Platform.Load("core", "1.1.5");
|
|
1387
|
+
* var testDE = DataExtension.Init("testDE");
|
|
1388
|
+
* var data = testDE.Rows.Lookup(["Age"], [25], 2, "LastName");
|
|
1389
|
+
*/
|
|
120
1390
|
Lookup(searchFieldNames: any[], searchValues: any[], limit?: number, orderByFieldName?: string): object[];
|
|
1391
|
+
/**
|
|
1392
|
+
* 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.
|
|
1393
|
+
*
|
|
1394
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1395
|
+
* @param columnNames - Array of column names to match against.
|
|
1396
|
+
* @param columnValues - Array of values to match (one per column, in order).
|
|
1397
|
+
* @returns The number of rows that were modified (deleted).
|
|
1398
|
+
* @example
|
|
1399
|
+
* Platform.Load("Core", "1.1.5");
|
|
1400
|
+
* var memberDE = DataExtension.Init("MembershipRewards");
|
|
1401
|
+
* var result = memberDE.Rows.Remove(["Area"], ["Kensington"]);
|
|
1402
|
+
*/
|
|
121
1403
|
Remove(columnNames: any[], columnValues: any[]): number;
|
|
1404
|
+
/**
|
|
1405
|
+
* 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.
|
|
1406
|
+
*
|
|
1407
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1408
|
+
* @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`.
|
|
1409
|
+
* @returns Rows from the data extension matching the filter (or all rows when no filter is supplied).
|
|
1410
|
+
* @example
|
|
1411
|
+
* Platform.Load("core", "1.1.5");
|
|
1412
|
+
* var birthdayDE = DataExtension.Init("birthdayDE");
|
|
1413
|
+
* var data = birthdayDE.Rows.Retrieve();
|
|
1414
|
+
* var filter = { Property: "Age", SimpleOperator: "greaterThan", Value: 20 };
|
|
1415
|
+
* var moredata = birthdayDE.Rows.Retrieve(filter);
|
|
1416
|
+
*/
|
|
122
1417
|
Retrieve(filter?: object): object[];
|
|
1418
|
+
/**
|
|
1419
|
+
* Updates the columns of rows where `whereFieldNames` equal `whereValues` (AND-joined). Throws if no row matches.
|
|
1420
|
+
*
|
|
1421
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1422
|
+
* @param rowData - Object whose keys are columns to update and values are the new values.
|
|
1423
|
+
* @param whereFieldNames - Array of column names to match against.
|
|
1424
|
+
* @param whereValues - Array of values to match (one per column, in order).
|
|
1425
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1426
|
+
* @example
|
|
1427
|
+
* Platform.Load("Core", "1");
|
|
1428
|
+
* var dataExt = DataExtension.Init("NTO Customer List");
|
|
1429
|
+
* var fieldsToUpdate = { StateProvince: "QC", PreferredActivity: "Sailing" };
|
|
1430
|
+
* var result = dataExt.Rows.Update(fieldsToUpdate, ["MemberId", "Country"], [9868600, "CA"]);
|
|
1431
|
+
*/
|
|
123
1432
|
Update(rowData: object, whereFieldNames: any[], whereValues: any[]): string;
|
|
124
1433
|
}
|
|
125
1434
|
interface DataExtensionInstance {
|
|
126
|
-
Fields:
|
|
127
|
-
Rows:
|
|
1435
|
+
Fields: DataExtensionFields;
|
|
1436
|
+
Rows: DataExtensionRows;
|
|
128
1437
|
}
|
|
129
1438
|
|
|
130
1439
|
// ── Core Library namespaces ──────────────────────────────────────────────────
|
|
131
1440
|
declare namespace Account {
|
|
1441
|
+
/**
|
|
1442
|
+
* Initializes an Account instance bound to the specified external key. Required before invoking any other Account method on the returned instance.
|
|
1443
|
+
*
|
|
1444
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/account/)
|
|
1445
|
+
*
|
|
1446
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1447
|
+
* @param key - External key of the account.
|
|
1448
|
+
* @returns An initialized Account bound to the specified external key.
|
|
1449
|
+
* @example
|
|
1450
|
+
* Platform.Load("core", "1.1.5");
|
|
1451
|
+
* var myAccount = Account.Init("MyCustomerKey");
|
|
1452
|
+
*/
|
|
132
1453
|
function Init(key: string): any;
|
|
1454
|
+
/**
|
|
1455
|
+
* Retrieves accounts based on the specified filter criteria.
|
|
1456
|
+
*
|
|
1457
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/account/)
|
|
1458
|
+
*
|
|
1459
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1460
|
+
* @param filter - Criteria used to search for the account. Use a filter expression or a JSON object containing filter and additional search parameters.
|
|
1461
|
+
* @returns List of results matching the filter.
|
|
1462
|
+
* @example
|
|
1463
|
+
* Platform.Load("core", "1.1.5");
|
|
1464
|
+
* var getAcct = Account.Retrieve({Property:"CustomerKey",SimpleOperator:"equals",Value:"MyAccount"});
|
|
1465
|
+
*/
|
|
133
1466
|
function Retrieve(filter: object): object[];
|
|
1467
|
+
/**
|
|
1468
|
+
* Updates the account with the supplied attributes. If `properties` includes `TimeZoneID`, the call uses that value to update the account time zone.
|
|
1469
|
+
*
|
|
1470
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/account/)
|
|
1471
|
+
*
|
|
1472
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1473
|
+
* @param properties - Account attributes to change.
|
|
1474
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1475
|
+
* @example
|
|
1476
|
+
* Platform.Load("core", "1.1.5");
|
|
1477
|
+
* var myAccount = Account.Init("MyCustomerKey");
|
|
1478
|
+
* var status = myAccount.Update({ "FromName" : "Demo From Name" });
|
|
1479
|
+
*/
|
|
134
1480
|
function Update(properties: object): string;
|
|
135
1481
|
}
|
|
136
1482
|
declare namespace Account.Tracking {
|
|
1483
|
+
/**
|
|
1484
|
+
* Returns an array of tracking data related to the accounts specified by the passed filter argument.
|
|
1485
|
+
*
|
|
1486
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/account/)
|
|
1487
|
+
*
|
|
1488
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1489
|
+
* @param filter - Criteria used to search for the account.
|
|
1490
|
+
* @returns List of results matching the filter.
|
|
1491
|
+
* @example
|
|
1492
|
+
* Platform.Load("core", "1.1.5");
|
|
1493
|
+
* var acctTracking = Account.Tracking.Retrieve({Property:"CustomerKey",SimpleOperator:"equals",Value:"MyAccount"});
|
|
1494
|
+
*/
|
|
137
1495
|
function Retrieve(filter: object): object[];
|
|
138
1496
|
}
|
|
139
1497
|
declare namespace AccountUser {
|
|
1498
|
+
/**
|
|
1499
|
+
* 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.
|
|
1500
|
+
*
|
|
1501
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/accountuser/)
|
|
1502
|
+
*
|
|
1503
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1504
|
+
* @param targetUserKey - External key of the user.
|
|
1505
|
+
* @param myClientID - MID of the business unit.
|
|
1506
|
+
* @returns An initialized AccountUser bound to the specified external key and client ID.
|
|
1507
|
+
* @example
|
|
1508
|
+
* Platform.Load("core", "1.1.5");
|
|
1509
|
+
* var acctUser = AccountUser.Init("myAccountUser", 123456789);
|
|
1510
|
+
*/
|
|
140
1511
|
function Init(targetUserKey: string, myClientID: number): any;
|
|
1512
|
+
/**
|
|
1513
|
+
* Creates a new account user from the supplied properties object.
|
|
1514
|
+
*
|
|
1515
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/accountuser/)
|
|
1516
|
+
*
|
|
1517
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1518
|
+
* @param properties - JSON object describing the new account user (Name, UserID, Password, Email, ClientID, DefaultBusinessUnitKey, AssociatedBusinessUnits, ...).
|
|
1519
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1520
|
+
* @example
|
|
1521
|
+
* Platform.Load("core", "1.1.5");
|
|
1522
|
+
* var newUser = {
|
|
1523
|
+
* "Name": "Andrea Cruz",
|
|
1524
|
+
* "UserID": "acruz",
|
|
1525
|
+
* "Password": "insert new password here",
|
|
1526
|
+
* "Email": "acruz@example.com",
|
|
1527
|
+
* "ClientID": 123456789,
|
|
1528
|
+
* "DefaultBusinessUnitKey": "childBUKey",
|
|
1529
|
+
* "AssociatedBusinessUnits": ["childBUKey", "grandchildBUKey"]
|
|
1530
|
+
* };
|
|
1531
|
+
* var status = AccountUser.Add(newUser);
|
|
1532
|
+
*/
|
|
141
1533
|
function Add(properties: object): string;
|
|
1534
|
+
/**
|
|
1535
|
+
* Retrieves account users based on the specified filter criteria.
|
|
1536
|
+
*
|
|
1537
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/accountuser/)
|
|
1538
|
+
*
|
|
1539
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1540
|
+
* @param filter - Criteria used to search for the account user.
|
|
1541
|
+
* @returns List of results matching the filter.
|
|
1542
|
+
* @example
|
|
1543
|
+
* Platform.Load("core", "1.1.5");
|
|
1544
|
+
* var accountUser = AccountUser.Retrieve({Property:"CustomerKey",SimpleOperator:"equals",Value:"MyAccount"});
|
|
1545
|
+
*/
|
|
142
1546
|
function Retrieve(filter: object): object[];
|
|
1547
|
+
/**
|
|
1548
|
+
* Updates the account user with the supplied attributes.
|
|
1549
|
+
*
|
|
1550
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/accountuser/)
|
|
1551
|
+
*
|
|
1552
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1553
|
+
* @param properties - Attributes of the account user to change.
|
|
1554
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1555
|
+
* @example
|
|
1556
|
+
* Platform.Load("core", "1.1.5");
|
|
1557
|
+
* var acctUser = AccountUser.Init("myAccountUser", 123456789);
|
|
1558
|
+
* var status = acctUser.Update({ "Password": "XXXXX" });
|
|
1559
|
+
*/
|
|
143
1560
|
function Update(properties: object): string;
|
|
1561
|
+
/**
|
|
1562
|
+
* Activates the account user.
|
|
1563
|
+
*
|
|
1564
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/accountuser/)
|
|
1565
|
+
*
|
|
1566
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1567
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1568
|
+
* @example
|
|
1569
|
+
* Platform.Load("core", "1.1.5");
|
|
1570
|
+
* var acctUser = AccountUser.Init("myAccountUser", 123456789);
|
|
1571
|
+
* var status = acctUser.Activate();
|
|
1572
|
+
*/
|
|
144
1573
|
function Activate(): string;
|
|
1574
|
+
/**
|
|
1575
|
+
* Deactivates the account user. Note: account users cannot be deleted via server-side JavaScript — deactivation is the only "removal" path.
|
|
1576
|
+
*
|
|
1577
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/accountuser/)
|
|
1578
|
+
*
|
|
1579
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1580
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1581
|
+
* @example
|
|
1582
|
+
* Platform.Load("core", "1.1.5");
|
|
1583
|
+
* var acctUser = AccountUser.Init("myAccountUser", 123456789);
|
|
1584
|
+
* var status = acctUser.Deactivate();
|
|
1585
|
+
*/
|
|
145
1586
|
function Deactivate(): string;
|
|
146
1587
|
}
|
|
147
1588
|
declare namespace Portfolio {
|
|
1589
|
+
/**
|
|
1590
|
+
* Initializes a Portfolio instance bound to the specified external key. Required before invoking any other Portfolio method on the returned instance.
|
|
1591
|
+
*
|
|
1592
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/portfolio/)
|
|
1593
|
+
*
|
|
1594
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1595
|
+
* @param key - External key of the portfolio.
|
|
1596
|
+
* @returns An initialized Portfolio bound to the specified external key.
|
|
1597
|
+
* @example
|
|
1598
|
+
* Platform.Load("core", "1.1.5");
|
|
1599
|
+
* var portObj = Portfolio.Init("myPortfolioCK");
|
|
1600
|
+
*/
|
|
148
1601
|
function Init(key: string): any;
|
|
1602
|
+
/**
|
|
1603
|
+
* Creates a new portfolio (file) object from the supplied properties.
|
|
1604
|
+
*
|
|
1605
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/portfolio/)
|
|
1606
|
+
*
|
|
1607
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1608
|
+
* @param properties - JSON object describing the new portfolio item (DisplayName, CustomerKey, CategoryID, FileName, FileLocation).
|
|
1609
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1610
|
+
* @example
|
|
1611
|
+
* Platform.Load("core", "1.1.5");
|
|
1612
|
+
* var newPortfolio = {
|
|
1613
|
+
* DisplayName: "SSJS Portfolio Object",
|
|
1614
|
+
* CustomerKey: "myPortfolioCK",
|
|
1615
|
+
* CategoryID: 12345,
|
|
1616
|
+
* FileName: "logo.png",
|
|
1617
|
+
* FileLocation: "http://www.example.com/Portals/0/images/global/logo_main.png"
|
|
1618
|
+
* };
|
|
1619
|
+
* var status = Portfolio.Add(newPortfolio);
|
|
1620
|
+
*/
|
|
149
1621
|
function Add(properties: object): string;
|
|
1622
|
+
/**
|
|
1623
|
+
* Returns an array of portfolio objects matching the specified filter.
|
|
1624
|
+
*
|
|
1625
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/portfolio/)
|
|
1626
|
+
*
|
|
1627
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1628
|
+
* @param filter - Criteria used to search for portfolio objects. PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
1629
|
+
* @returns List of portfolio objects matching the filter.
|
|
1630
|
+
* @example
|
|
1631
|
+
* Platform.Load("core", "1.1.5");
|
|
1632
|
+
* var portObjArr = Portfolio.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "PortfolioObjectKey" });
|
|
1633
|
+
*/
|
|
150
1634
|
function Retrieve(filter: object): object[];
|
|
1635
|
+
/**
|
|
1636
|
+
* Updates the portfolio object with the supplied attributes.
|
|
1637
|
+
*
|
|
1638
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/portfolio/)
|
|
1639
|
+
*
|
|
1640
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1641
|
+
* @param properties - Attributes to change on the portfolio object.
|
|
1642
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1643
|
+
* @example
|
|
1644
|
+
* Platform.Load("core", "1.1.5");
|
|
1645
|
+
* var portObj = Portfolio.Init("myPortfolioCK");
|
|
1646
|
+
* var status = portObj.Update({ DisplayName: "Updated SSJS Image" });
|
|
1647
|
+
*/
|
|
151
1648
|
function Update(properties: object): string;
|
|
1649
|
+
/**
|
|
1650
|
+
* Removes the previously initialized portfolio object.
|
|
1651
|
+
*
|
|
1652
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/portfolio/)
|
|
1653
|
+
*
|
|
1654
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1655
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1656
|
+
* @example
|
|
1657
|
+
* Platform.Load("core", "1.1.5");
|
|
1658
|
+
* var portObj = Portfolio.Init("myPortfolioCK");
|
|
1659
|
+
* var status = portObj.Remove();
|
|
1660
|
+
*/
|
|
152
1661
|
function Remove(): string;
|
|
153
1662
|
}
|
|
154
1663
|
declare namespace ContentAreaObj {
|
|
1664
|
+
/**
|
|
1665
|
+
* 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.
|
|
1666
|
+
*
|
|
1667
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/contentareaobj/)
|
|
1668
|
+
*
|
|
1669
|
+
* @deprecated
|
|
1670
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1671
|
+
* @param key - External key of the content area.
|
|
1672
|
+
* @returns An initialized ContentAreaObj bound to the specified external key.
|
|
1673
|
+
* @example
|
|
1674
|
+
* Platform.Load("core", "1.1.5");
|
|
1675
|
+
* var area = ContentAreaObj.Init("myCA");
|
|
1676
|
+
*/
|
|
155
1677
|
function Init(key: string): any;
|
|
1678
|
+
/**
|
|
1679
|
+
* Creates a new content area from the supplied properties. DEPRECATED — calls fail on accounts where the Content Areas feature has been retired.
|
|
1680
|
+
*
|
|
1681
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/contentareaobj/)
|
|
1682
|
+
*
|
|
1683
|
+
* @deprecated
|
|
1684
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1685
|
+
* @param properties - JSON object describing the new content area (CustomerKey, Name, CategoryID, Layout, LayoutSpecified, Content).
|
|
1686
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1687
|
+
* @example
|
|
1688
|
+
* Platform.Load("core", "1.1.5");
|
|
1689
|
+
* var exampleArea = {
|
|
1690
|
+
* CustomerKey: "exampleArea",
|
|
1691
|
+
* Name: "SSJS Content Area Example",
|
|
1692
|
+
* CategoryID: 123456,
|
|
1693
|
+
* Layout: "RawText",
|
|
1694
|
+
* LayoutSpecified: true,
|
|
1695
|
+
* Content: "<b>This is example content</b>"
|
|
1696
|
+
* };
|
|
1697
|
+
* var status = ContentAreaObj.Add(exampleArea);
|
|
1698
|
+
*/
|
|
156
1699
|
function Add(properties: object): string;
|
|
1700
|
+
/**
|
|
1701
|
+
* 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.
|
|
1702
|
+
*
|
|
1703
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/contentareaobj/)
|
|
1704
|
+
*
|
|
1705
|
+
* @deprecated
|
|
1706
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1707
|
+
* @param filter - PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
1708
|
+
* @returns List of content areas matching the filter.
|
|
1709
|
+
* @example
|
|
1710
|
+
* Platform.Load("core", "1.1.5");
|
|
1711
|
+
* var results = ContentAreaObj.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "myCA" });
|
|
1712
|
+
*/
|
|
157
1713
|
function Retrieve(filter: object): object[];
|
|
1714
|
+
/**
|
|
1715
|
+
* Updates the content area with the supplied attributes. DEPRECATED — calls fail on accounts where the Content Areas feature has been retired.
|
|
1716
|
+
*
|
|
1717
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/contentareaobj/)
|
|
1718
|
+
*
|
|
1719
|
+
* @deprecated
|
|
1720
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1721
|
+
* @param properties - Attributes to change on the content area.
|
|
1722
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1723
|
+
* @example
|
|
1724
|
+
* Platform.Load("core", "1.1.5");
|
|
1725
|
+
* var obj = ContentAreaObj.Init("myCA");
|
|
1726
|
+
* var status = obj.Update({ Name: "Name Updated By SSJS" });
|
|
1727
|
+
*/
|
|
158
1728
|
function Update(properties: object): string;
|
|
1729
|
+
/**
|
|
1730
|
+
* Removes the previously initialized content area. DEPRECATED — calls fail on accounts where the Content Areas feature has been retired.
|
|
1731
|
+
*
|
|
1732
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/contentareaobj/)
|
|
1733
|
+
*
|
|
1734
|
+
* @deprecated
|
|
1735
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1736
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1737
|
+
* @example
|
|
1738
|
+
* Platform.Load("core", "1.1.5");
|
|
1739
|
+
* var obj = ContentAreaObj.Init("myCA");
|
|
1740
|
+
* var status = obj.Remove();
|
|
1741
|
+
*/
|
|
159
1742
|
function Remove(): string;
|
|
160
1743
|
}
|
|
161
1744
|
declare namespace Folder {
|
|
1745
|
+
/**
|
|
1746
|
+
* 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.
|
|
1747
|
+
*
|
|
1748
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/folder/)
|
|
1749
|
+
*
|
|
1750
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1751
|
+
* @param key - External key of the folder. Optional — pass nothing and use `SetID()` when the folder has no external key.
|
|
1752
|
+
* @returns An initialized Folder; bound to the specified external key when one is supplied.
|
|
1753
|
+
* @example
|
|
1754
|
+
* Platform.Load("core", "1");
|
|
1755
|
+
* var myFolder = Folder.Init("myFolder");
|
|
1756
|
+
* // or, when the folder has no external key:
|
|
1757
|
+
* var myIDFolder = Folder.Init();
|
|
1758
|
+
* myIDFolder.SetID(12345);
|
|
1759
|
+
*/
|
|
162
1760
|
function Init(key?: string): any;
|
|
1761
|
+
/**
|
|
1762
|
+
* Creates a new folder as a child of an existing folder.
|
|
1763
|
+
*
|
|
1764
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/folder/)
|
|
1765
|
+
*
|
|
1766
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1767
|
+
* @param properties - JSON object describing the new folder (Name, CustomerKey, Description, ContentType, IsActive, IsEditable, AllowChildren, ParentFolderID).
|
|
1768
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1769
|
+
* @example
|
|
1770
|
+
* Platform.Load("core", "1.1.5");
|
|
1771
|
+
* var newFolder = {
|
|
1772
|
+
* Name: "Test Add Folder",
|
|
1773
|
+
* CustomerKey: "test_folder_key",
|
|
1774
|
+
* Description: "Test added",
|
|
1775
|
+
* ContentType: "email",
|
|
1776
|
+
* IsActive: "true",
|
|
1777
|
+
* IsEditable: "true",
|
|
1778
|
+
* AllowChildren: "false",
|
|
1779
|
+
* ParentFolderID: 123456
|
|
1780
|
+
* };
|
|
1781
|
+
* var status = Folder.Add(newFolder);
|
|
1782
|
+
*/
|
|
163
1783
|
function Add(properties: object): string;
|
|
1784
|
+
/**
|
|
1785
|
+
* 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.
|
|
1786
|
+
*
|
|
1787
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/folder/)
|
|
1788
|
+
*
|
|
1789
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1790
|
+
* @param filter - WSProxy-style filter object — simple or compound with `AND`/`OR`.
|
|
1791
|
+
* @returns Array of folder objects (including nested `ParentFolder` info).
|
|
1792
|
+
* @example
|
|
1793
|
+
* Platform.Load("core", "1");
|
|
1794
|
+
* var folders = Folder.Retrieve({
|
|
1795
|
+
* Property: "ParentFolder.Name",
|
|
1796
|
+
* SimpleOperator: "equals",
|
|
1797
|
+
* Value: "RewardsProgram"
|
|
1798
|
+
* });
|
|
1799
|
+
* Write(Stringify(folders));
|
|
1800
|
+
*/
|
|
164
1801
|
function Retrieve(filter: object): object[];
|
|
1802
|
+
/**
|
|
1803
|
+
* Updates the folder with the supplied attributes.
|
|
1804
|
+
*
|
|
1805
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/folder/)
|
|
1806
|
+
*
|
|
1807
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1808
|
+
* @param properties - Attributes to change on the folder.
|
|
1809
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1810
|
+
* @example
|
|
1811
|
+
* Platform.Load("core", "1.1.5");
|
|
1812
|
+
* var myFolder = Folder.Init("myFolder");
|
|
1813
|
+
* var status = myFolder.Update({ Name: "Updated Folder Name" });
|
|
1814
|
+
*/
|
|
165
1815
|
function Update(properties: object): string;
|
|
1816
|
+
/**
|
|
1817
|
+
* Removes the previously initialized folder.
|
|
1818
|
+
*
|
|
1819
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/folder/)
|
|
1820
|
+
*
|
|
1821
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1822
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1823
|
+
* @example
|
|
1824
|
+
* Platform.Load("core", "1.1.5");
|
|
1825
|
+
* var myFolder = Folder.Init("myFolder");
|
|
1826
|
+
* myFolder.Remove();
|
|
1827
|
+
*/
|
|
166
1828
|
function Remove(): string;
|
|
1829
|
+
/**
|
|
1830
|
+
* 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.
|
|
1831
|
+
*
|
|
1832
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/folder/)
|
|
1833
|
+
*
|
|
1834
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1835
|
+
* @param id - The folder ID to bind to this Folder instance.
|
|
1836
|
+
* @returns No return value.
|
|
1837
|
+
* @example
|
|
1838
|
+
* Platform.Load("core", "1.1.5");
|
|
1839
|
+
* var myIDFolder = Folder.Init();
|
|
1840
|
+
* myIDFolder.SetID(12345);
|
|
1841
|
+
*/
|
|
167
1842
|
function SetID(id: number): void;
|
|
168
1843
|
}
|
|
169
1844
|
declare namespace Template {
|
|
1845
|
+
/**
|
|
1846
|
+
* Initializes a Template instance bound to the specified external key. Required before invoking any other Template method on the returned instance.
|
|
1847
|
+
*
|
|
1848
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/template/)
|
|
1849
|
+
*
|
|
1850
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1851
|
+
* @param key - External key of the template.
|
|
1852
|
+
* @returns An initialized Template bound to the specified external key.
|
|
1853
|
+
* @example
|
|
1854
|
+
* Platform.Load("core", "1");
|
|
1855
|
+
* var t = Template.Init("myTemplate");
|
|
1856
|
+
*/
|
|
170
1857
|
function Init(key: string): any;
|
|
1858
|
+
/**
|
|
1859
|
+
* Creates a new template from the supplied properties.
|
|
1860
|
+
*
|
|
1861
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/template/)
|
|
1862
|
+
*
|
|
1863
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1864
|
+
* @param properties - JSON object describing the new template (CustomerKey, TemplateName, LayoutHTML).
|
|
1865
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1866
|
+
* @example
|
|
1867
|
+
* Platform.Load("core", "1");
|
|
1868
|
+
* var myTemp = {
|
|
1869
|
+
* CustomerKey: "test_template",
|
|
1870
|
+
* TemplateName: "SSJS Test Template",
|
|
1871
|
+
* LayoutHTML: "this is some HTML"
|
|
1872
|
+
* };
|
|
1873
|
+
* var status = Template.Add(myTemp);
|
|
1874
|
+
*/
|
|
171
1875
|
function Add(properties: object): string;
|
|
1876
|
+
/**
|
|
1877
|
+
* Returns an array of templates matching the specified filter. Pass `{ Filter: { Property, SimpleOperator, Value }, QueryAllAccounts: true }` to query across all accessible accounts.
|
|
1878
|
+
*
|
|
1879
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/template/)
|
|
1880
|
+
*
|
|
1881
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1882
|
+
* @param filter - PascalCase WSProxy-style filter object, optionally wrapped with `QueryAllAccounts: true`.
|
|
1883
|
+
* @returns List of templates matching the filter.
|
|
1884
|
+
* @example
|
|
1885
|
+
* Platform.Load("core", "1.1.5");
|
|
1886
|
+
* var getTemplate = Template.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "MyTemplate" });
|
|
1887
|
+
*/
|
|
172
1888
|
function Retrieve(filter: object): object[];
|
|
1889
|
+
/**
|
|
1890
|
+
* Updates the template with the supplied attributes.
|
|
1891
|
+
*
|
|
1892
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/template/)
|
|
1893
|
+
*
|
|
1894
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1895
|
+
* @param properties - Attributes to change on the template.
|
|
1896
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1897
|
+
* @example
|
|
1898
|
+
* Platform.Load("core", "1.1.5");
|
|
1899
|
+
* var myTemplate = Template.Init("myTemplateCK");
|
|
1900
|
+
* var status = myTemplate.Update({ TemplateName: "Edited Template" });
|
|
1901
|
+
*/
|
|
173
1902
|
function Update(properties: object): string;
|
|
174
1903
|
}
|
|
175
1904
|
declare namespace DeliveryProfile {
|
|
1905
|
+
/**
|
|
1906
|
+
* Initializes a DeliveryProfile instance bound to the specified external key. Required before invoking any other DeliveryProfile method on the returned instance.
|
|
1907
|
+
*
|
|
1908
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/deliveryprofile/)
|
|
1909
|
+
*
|
|
1910
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1911
|
+
* @param key - External key of the delivery profile.
|
|
1912
|
+
* @returns An initialized DeliveryProfile bound to the specified external key.
|
|
1913
|
+
* @example
|
|
1914
|
+
* Platform.Load("core", "1");
|
|
1915
|
+
* var myProfile = DeliveryProfile.Init("myDeliveryProfile");
|
|
1916
|
+
*/
|
|
176
1917
|
function Init(key: string): any;
|
|
1918
|
+
/**
|
|
1919
|
+
* Creates a new delivery profile from the supplied properties.
|
|
1920
|
+
*
|
|
1921
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/deliveryprofile/)
|
|
1922
|
+
*
|
|
1923
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1924
|
+
* @param properties - JSON object describing the new delivery profile (Name, CustomerKey, Description, SourceAddressType, ...).
|
|
1925
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1926
|
+
* @example
|
|
1927
|
+
* Platform.Load("core", "1.1.5");
|
|
1928
|
+
* var newDP = {
|
|
1929
|
+
* Name: "SSJS Added Delivery Profile",
|
|
1930
|
+
* CustomerKey: "test_delivery_profile",
|
|
1931
|
+
* Description: "An SSJS Added Profile",
|
|
1932
|
+
* SourceAddressType: "DefaultPrivateIPAddress"
|
|
1933
|
+
* };
|
|
1934
|
+
* var status = DeliveryProfile.Add(newDP);
|
|
1935
|
+
*/
|
|
177
1936
|
function Add(properties: object): string;
|
|
1937
|
+
/**
|
|
1938
|
+
* Updates the delivery profile with the supplied attributes.
|
|
1939
|
+
*
|
|
1940
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/deliveryprofile/)
|
|
1941
|
+
*
|
|
1942
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1943
|
+
* @param properties - Attributes to change on the delivery profile.
|
|
1944
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1945
|
+
* @example
|
|
1946
|
+
* Platform.Load("core", "1.1.5");
|
|
1947
|
+
* var myProfile = DeliveryProfile.Init("myDeliveryProfile");
|
|
1948
|
+
* var status = myProfile.Update({ Name: "SSJS Updated Delivery Profile" });
|
|
1949
|
+
*/
|
|
178
1950
|
function Update(properties: object): string;
|
|
1951
|
+
/**
|
|
1952
|
+
* Removes the previously initialized delivery profile.
|
|
1953
|
+
*
|
|
1954
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/deliveryprofile/)
|
|
1955
|
+
*
|
|
1956
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1957
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1958
|
+
* @example
|
|
1959
|
+
* Platform.Load("core", "1.1.5");
|
|
1960
|
+
* var myProfile = DeliveryProfile.Init("myDeliveryProfile");
|
|
1961
|
+
* var status = myProfile.Remove();
|
|
1962
|
+
*/
|
|
179
1963
|
function Remove(): string;
|
|
180
1964
|
}
|
|
181
1965
|
declare namespace SenderProfile {
|
|
1966
|
+
/**
|
|
1967
|
+
* 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.
|
|
1968
|
+
*
|
|
1969
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senderprofile/)
|
|
1970
|
+
*
|
|
1971
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1972
|
+
* @param key - External key of the sender profile.
|
|
1973
|
+
* @returns An initialized SenderProfile bound to the specified external key.
|
|
1974
|
+
* @example
|
|
1975
|
+
* Platform.Load("core", "1");
|
|
1976
|
+
* var myProfile = SenderProfile.Init("mySenderProfile");
|
|
1977
|
+
*/
|
|
182
1978
|
function Init(key: string): any;
|
|
1979
|
+
/**
|
|
1980
|
+
* Creates a new sender profile from the supplied properties.
|
|
1981
|
+
*
|
|
1982
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senderprofile/)
|
|
1983
|
+
*
|
|
1984
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1985
|
+
* @param properties - JSON object describing the new sender profile (Name, CustomerKey, Description, FromName, FromAddress, ...).
|
|
1986
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
1987
|
+
* @example
|
|
1988
|
+
* Platform.Load("core", "1.1.5");
|
|
1989
|
+
* var newSP = {
|
|
1990
|
+
* Name: "SSJS Added Send Profile",
|
|
1991
|
+
* CustomerKey: "test_send_profile",
|
|
1992
|
+
* Description: "An SSJS Added Profile",
|
|
1993
|
+
* FromName: "Andrea Cruz",
|
|
1994
|
+
* FromAddress: "acruz@example.com"
|
|
1995
|
+
* };
|
|
1996
|
+
* var status = SenderProfile.Add(newSP);
|
|
1997
|
+
*/
|
|
183
1998
|
function Add(properties: object): string;
|
|
1999
|
+
/**
|
|
2000
|
+
* Updates the sender profile with the supplied attributes.
|
|
2001
|
+
*
|
|
2002
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senderprofile/)
|
|
2003
|
+
*
|
|
2004
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2005
|
+
* @param properties - Attributes to change on the sender profile.
|
|
2006
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2007
|
+
* @example
|
|
2008
|
+
* Platform.Load("core", "1.1.5");
|
|
2009
|
+
* var myProfile = SenderProfile.Init("mySenderProfile");
|
|
2010
|
+
* var status = myProfile.Update({ Name: "SSJS Updated Sender Profile" });
|
|
2011
|
+
*/
|
|
184
2012
|
function Update(properties: object): string;
|
|
2013
|
+
/**
|
|
2014
|
+
* Removes the previously initialized sender profile.
|
|
2015
|
+
*
|
|
2016
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senderprofile/)
|
|
2017
|
+
*
|
|
2018
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2019
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2020
|
+
* @example
|
|
2021
|
+
* Platform.Load("core", "1.1.5");
|
|
2022
|
+
* var myProfile = SenderProfile.Init("mySenderProfile");
|
|
2023
|
+
* var status = myProfile.Remove();
|
|
2024
|
+
*/
|
|
185
2025
|
function Remove(): string;
|
|
186
2026
|
}
|
|
187
2027
|
declare namespace SendClassification {
|
|
2028
|
+
/**
|
|
2029
|
+
* Initializes a SendClassification instance bound to the specified external key. Required before invoking any other SendClassification method on the returned instance.
|
|
2030
|
+
*
|
|
2031
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/sendclassification/)
|
|
2032
|
+
*
|
|
2033
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2034
|
+
* @param key - External key of the send classification.
|
|
2035
|
+
* @returns An initialized SendClassification bound to the specified external key.
|
|
2036
|
+
* @example
|
|
2037
|
+
* Platform.Load("core", "1");
|
|
2038
|
+
* var sc = SendClassification.Init("mySendClassification");
|
|
2039
|
+
*/
|
|
188
2040
|
function Init(key: string): any;
|
|
2041
|
+
/**
|
|
2042
|
+
* Creates a new send classification from the supplied properties.
|
|
2043
|
+
*
|
|
2044
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/sendclassification/)
|
|
2045
|
+
*
|
|
2046
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2047
|
+
* @param properties - JSON object describing the new send classification (CustomerKey, Name, Description, SenderProfileKey, DeliveryProfileKey).
|
|
2048
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2049
|
+
* @example
|
|
2050
|
+
* Platform.Load("core", "1.1.5");
|
|
2051
|
+
* var newSC = {
|
|
2052
|
+
* CustomerKey: "mySCKey",
|
|
2053
|
+
* Name: "SSJS Test SC",
|
|
2054
|
+
* Description: "Test SSJS description",
|
|
2055
|
+
* SenderProfileKey: "mySPKey",
|
|
2056
|
+
* DeliveryProfileKey: "myDPKey"
|
|
2057
|
+
* };
|
|
2058
|
+
* SendClassification.Add(newSC);
|
|
2059
|
+
*/
|
|
189
2060
|
function Add(properties: object): string;
|
|
2061
|
+
/**
|
|
2062
|
+
* Returns an array of send classifications matching the specified filter.
|
|
2063
|
+
*
|
|
2064
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/sendclassification/)
|
|
2065
|
+
*
|
|
2066
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2067
|
+
* @param filter - PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
2068
|
+
* @returns List of send classifications matching the filter.
|
|
2069
|
+
* @example
|
|
2070
|
+
* Platform.Load("core", "1.1.5");
|
|
2071
|
+
* var results = SendClassification.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "mySendClassification" });
|
|
2072
|
+
*/
|
|
190
2073
|
function Retrieve(filter: object): object[];
|
|
2074
|
+
/**
|
|
2075
|
+
* Updates the send classification with the supplied attributes. You must include both `SenderProfileKey` and `DeliveryProfileKey` in `properties` for the update to succeed.
|
|
2076
|
+
*
|
|
2077
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/sendclassification/)
|
|
2078
|
+
*
|
|
2079
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2080
|
+
* @param properties - Attributes to change. Must include `SenderProfileKey` and `DeliveryProfileKey`.
|
|
2081
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2082
|
+
* @example
|
|
2083
|
+
* Platform.Load("core", "1.1.5");
|
|
2084
|
+
* var sc = SendClassification.Init("mySendClassification");
|
|
2085
|
+
* var updatedSC = {
|
|
2086
|
+
* Name: "Updated Send Classification",
|
|
2087
|
+
* SenderProfileKey: "mySPKey",
|
|
2088
|
+
* DeliveryProfileKey: "myDPKey"
|
|
2089
|
+
* };
|
|
2090
|
+
* var status = sc.Update(updatedSC);
|
|
2091
|
+
*/
|
|
191
2092
|
function Update(properties: object): string;
|
|
2093
|
+
/**
|
|
2094
|
+
* Removes the previously initialized send classification.
|
|
2095
|
+
*
|
|
2096
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/sendclassification/)
|
|
2097
|
+
*
|
|
2098
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2099
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2100
|
+
* @example
|
|
2101
|
+
* Platform.Load("core", "1.1.5");
|
|
2102
|
+
* var sc = SendClassification.Init("mySendClassification");
|
|
2103
|
+
* var status = sc.Remove();
|
|
2104
|
+
*/
|
|
192
2105
|
function Remove(): string;
|
|
193
2106
|
}
|
|
194
2107
|
declare namespace FilterDefinition {
|
|
2108
|
+
/**
|
|
2109
|
+
* Initializes a FilterDefinition instance bound to the specified external key. Required before invoking any other FilterDefinition method on the returned instance.
|
|
2110
|
+
*
|
|
2111
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/filterdefinition/)
|
|
2112
|
+
*
|
|
2113
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2114
|
+
* @param key - External key of the filter definition.
|
|
2115
|
+
* @returns An initialized FilterDefinition bound to the specified external key.
|
|
2116
|
+
* @example
|
|
2117
|
+
* Platform.Load("core", "1");
|
|
2118
|
+
* var fd = FilterDefinition.Init("myFilterDef");
|
|
2119
|
+
*/
|
|
195
2120
|
function Init(key: string): any;
|
|
2121
|
+
/**
|
|
2122
|
+
* 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"`.
|
|
2123
|
+
*
|
|
2124
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/filterdefinition/)
|
|
2125
|
+
*
|
|
2126
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2127
|
+
* @param properties - JSON object describing the new filter definition (Name, CustomerKey, Filter, DataSource).
|
|
2128
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2129
|
+
* @example
|
|
2130
|
+
* Platform.Load("core", "1.1.5");
|
|
2131
|
+
* var filterObj = { Property: "LuckyNumber", SimpleOperator: "equals", Value: 77 };
|
|
2132
|
+
* var newFD = {
|
|
2133
|
+
* Name: "SSJS Filter Definition",
|
|
2134
|
+
* CustomerKey: "myFilterDef",
|
|
2135
|
+
* Filter: filterObj,
|
|
2136
|
+
* DataSource: { Type: "SubscriberList", CustomerKey: "example_list_key" }
|
|
2137
|
+
* };
|
|
2138
|
+
* var status = FilterDefinition.Add(newFD);
|
|
2139
|
+
*/
|
|
196
2140
|
function Add(properties: object): string;
|
|
2141
|
+
/**
|
|
2142
|
+
* Returns an array of filter definitions matching the specified filter.
|
|
2143
|
+
*
|
|
2144
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/filterdefinition/)
|
|
2145
|
+
*
|
|
2146
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2147
|
+
* @param filter - PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
2148
|
+
* @returns List of filter definitions matching the filter.
|
|
2149
|
+
* @example
|
|
2150
|
+
* Platform.Load("core", "1.1.5");
|
|
2151
|
+
* var results = FilterDefinition.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "myFilterDef" });
|
|
2152
|
+
*/
|
|
197
2153
|
function Retrieve(filter: object): object[];
|
|
2154
|
+
/**
|
|
2155
|
+
* Updates the filter definition with the supplied attributes.
|
|
2156
|
+
*
|
|
2157
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/filterdefinition/)
|
|
2158
|
+
*
|
|
2159
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2160
|
+
* @param properties - Attributes to change on the filter definition.
|
|
2161
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2162
|
+
* @example
|
|
2163
|
+
* Platform.Load("core", "1.1.5");
|
|
2164
|
+
* var fd = FilterDefinition.Init("myFilterDef");
|
|
2165
|
+
* var status = fd.Update({ Name: "Updated Name" });
|
|
2166
|
+
*/
|
|
198
2167
|
function Update(properties: object): string;
|
|
2168
|
+
/**
|
|
2169
|
+
* Deletes the previously initialized filter definition.
|
|
2170
|
+
*
|
|
2171
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/filterdefinition/)
|
|
2172
|
+
*
|
|
2173
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2174
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2175
|
+
* @example
|
|
2176
|
+
* Platform.Load("core", "1.1.5");
|
|
2177
|
+
* var myFD = FilterDefinition.Init("myFilterDef");
|
|
2178
|
+
* myFD.Remove();
|
|
2179
|
+
*/
|
|
199
2180
|
function Remove(): string;
|
|
200
2181
|
}
|
|
201
2182
|
declare namespace QueryDefinition {
|
|
2183
|
+
/**
|
|
2184
|
+
* Initializes a QueryDefinition instance bound to the specified external key. Required before invoking any other QueryDefinition method on the returned instance.
|
|
2185
|
+
*
|
|
2186
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/querydefinition/)
|
|
2187
|
+
*
|
|
2188
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2189
|
+
* @param key - External key of the query definition.
|
|
2190
|
+
* @returns An initialized QueryDefinition bound to the specified external key.
|
|
2191
|
+
* @example
|
|
2192
|
+
* Platform.Load("core", "1");
|
|
2193
|
+
* var qd = QueryDefinition.Init("myQueryDef");
|
|
2194
|
+
*/
|
|
202
2195
|
function Init(key: string): any;
|
|
2196
|
+
/**
|
|
2197
|
+
* Creates a new query definition from the supplied properties. Pass an optional `CategoryID` to place the query inside a specific folder.
|
|
2198
|
+
*
|
|
2199
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/querydefinition/)
|
|
2200
|
+
*
|
|
2201
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2202
|
+
* @param properties - JSON object describing the new query definition (Name, CustomerKey, optional CategoryID, TargetUpdateType, TargetType, Target, QueryText).
|
|
2203
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2204
|
+
* @example
|
|
2205
|
+
* Platform.Load("core", "1.1.5");
|
|
2206
|
+
* var queryDef = {
|
|
2207
|
+
* Name: "Example Query Definition",
|
|
2208
|
+
* CustomerKey: "myQueryDef",
|
|
2209
|
+
* TargetUpdateType: "Overwrite",
|
|
2210
|
+
* TargetType: "DE",
|
|
2211
|
+
* Target: { Name: "Example Target DE", CustomerKey: "example_target_de" },
|
|
2212
|
+
* QueryText: "SELECT SubKey, Email, Name FROM [Example Target DE] where FavoriteItemID=77"
|
|
2213
|
+
* };
|
|
2214
|
+
* var status = QueryDefinition.Add(queryDef);
|
|
2215
|
+
*/
|
|
203
2216
|
function Add(properties: object): string;
|
|
2217
|
+
/**
|
|
2218
|
+
* Returns an array of query definitions matching the specified filter. Supports simple `{Property, SimpleOperator, Value}` filters and complex filters with `LeftOperand`, `LogicalOperator`, `RightOperand`.
|
|
2219
|
+
*
|
|
2220
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/querydefinition/)
|
|
2221
|
+
*
|
|
2222
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2223
|
+
* @param filter - WSProxy-style filter object — simple or compound with `AND`/`OR`.
|
|
2224
|
+
* @returns Array of query definition objects (with nested `DataExtensionTarget` info when applicable).
|
|
2225
|
+
* @example
|
|
2226
|
+
* Platform.Load("Core", "1");
|
|
2227
|
+
* var result = QueryDefinition.Retrieve({
|
|
2228
|
+
* Property: "Status",
|
|
2229
|
+
* SimpleOperator: "equals",
|
|
2230
|
+
* Value: "Active"
|
|
2231
|
+
* });
|
|
2232
|
+
* Write(Stringify(result));
|
|
2233
|
+
*/
|
|
204
2234
|
function Retrieve(filter: object): object[];
|
|
2235
|
+
/**
|
|
2236
|
+
* Updates the query definition with the supplied attributes.
|
|
2237
|
+
*
|
|
2238
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/querydefinition/)
|
|
2239
|
+
*
|
|
2240
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2241
|
+
* @param properties - Attributes to change on the query definition.
|
|
2242
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2243
|
+
* @example
|
|
2244
|
+
* Platform.Load("core", "1.1.5");
|
|
2245
|
+
* var qd = QueryDefinition.Init("myQueryDef");
|
|
2246
|
+
* var status = qd.Update({
|
|
2247
|
+
* Name: "Updated Query Definition Name",
|
|
2248
|
+
* QueryText: "SELECT SubKey, Email, Name FROM [Example Target DE] where FavoriteItemID=12"
|
|
2249
|
+
* });
|
|
2250
|
+
*/
|
|
205
2251
|
function Update(properties: object): string;
|
|
2252
|
+
/**
|
|
2253
|
+
* Removes the previously initialized query definition.
|
|
2254
|
+
*
|
|
2255
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/querydefinition/)
|
|
2256
|
+
*
|
|
2257
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2258
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2259
|
+
* @example
|
|
2260
|
+
* Platform.Load("core", "1.1.5");
|
|
2261
|
+
* var qd = QueryDefinition.Init("myQueryDef");
|
|
2262
|
+
* var status = qd.Remove();
|
|
2263
|
+
*/
|
|
206
2264
|
function Remove(): string;
|
|
2265
|
+
/**
|
|
2266
|
+
* Executes the query definition. Runs the SQL and writes results into the configured target Data Extension.
|
|
2267
|
+
*
|
|
2268
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/querydefinition/)
|
|
2269
|
+
*
|
|
2270
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2271
|
+
* @param action - The action to perform. Use `"start"` to execute the query.
|
|
2272
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2273
|
+
* @example
|
|
2274
|
+
* Platform.Load("core", "1");
|
|
2275
|
+
* var qd = QueryDefinition.Init("MY_QUERY_KEY");
|
|
2276
|
+
* var result = qd.Perform("start");
|
|
2277
|
+
* Write(Stringify(result));
|
|
2278
|
+
*/
|
|
207
2279
|
function Perform(action: string): string;
|
|
208
2280
|
}
|
|
209
2281
|
declare namespace List {
|
|
2282
|
+
/**
|
|
2283
|
+
* Initializes a List instance bound to the specified external key. Required before invoking any other List method on the returned instance.
|
|
2284
|
+
*
|
|
2285
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list/)
|
|
2286
|
+
*
|
|
2287
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2288
|
+
* @param key - External key of the list.
|
|
2289
|
+
* @returns An initialized List bound to the specified external key.
|
|
2290
|
+
* @example
|
|
2291
|
+
* Platform.Load("core", "1");
|
|
2292
|
+
* var myList = List.Init("myList");
|
|
2293
|
+
*/
|
|
210
2294
|
function Init(key: string): any;
|
|
2295
|
+
/**
|
|
2296
|
+
* 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"`.
|
|
2297
|
+
*
|
|
2298
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list/)
|
|
2299
|
+
*
|
|
2300
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2301
|
+
* @param properties - JSON object describing the new list (CustomerKey, Name, Description, ...).
|
|
2302
|
+
* @returns An initialized List bound to the newly-created list.
|
|
2303
|
+
* @example
|
|
2304
|
+
* Platform.Load("core", "1.1.5");
|
|
2305
|
+
* var myNewList = List.Add({ CustomerKey: "libList", Name: "testLib", Description: "desc" });
|
|
2306
|
+
*/
|
|
211
2307
|
function Add(properties: object): any;
|
|
2308
|
+
/**
|
|
2309
|
+
* Returns an array of lists matching the specified filter.
|
|
2310
|
+
*
|
|
2311
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list/)
|
|
2312
|
+
*
|
|
2313
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2314
|
+
* @param filter - PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
2315
|
+
* @returns List of list objects matching the filter.
|
|
2316
|
+
* @example
|
|
2317
|
+
* Platform.Load("core", "1.1.5");
|
|
2318
|
+
* var lists = List.Retrieve({ Property: "ListName", SimpleOperator: "equals", Value: "BirthdayList" });
|
|
2319
|
+
*/
|
|
212
2320
|
function Retrieve(filter: object): object[];
|
|
2321
|
+
/**
|
|
2322
|
+
* Removes the previously initialized list.
|
|
2323
|
+
*
|
|
2324
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list/)
|
|
2325
|
+
*
|
|
2326
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2327
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2328
|
+
* @example
|
|
2329
|
+
* Platform.Load("core", "1.1.5");
|
|
2330
|
+
* var myList = List.Init("myList");
|
|
2331
|
+
* var status = myList.Remove();
|
|
2332
|
+
*/
|
|
213
2333
|
function Remove(): string;
|
|
214
2334
|
}
|
|
215
2335
|
declare namespace List.Subscribers {
|
|
2336
|
+
/**
|
|
2337
|
+
* Adds a subscriber to the previously initialized list.
|
|
2338
|
+
*
|
|
2339
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
|
|
2340
|
+
*
|
|
2341
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2342
|
+
* @param properties - Object containing subscriber properties (EmailAddress, SubscriberKey, optionally list status).
|
|
2343
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2344
|
+
* @example
|
|
2345
|
+
* Platform.Load("core", "1");
|
|
2346
|
+
* var list = List.Init("MY_LIST_KEY");
|
|
2347
|
+
* var result = list.Subscribers.Add({
|
|
2348
|
+
* EmailAddress: "test@example.com",
|
|
2349
|
+
* SubscriberKey: "test@example.com"
|
|
2350
|
+
* });
|
|
2351
|
+
* Write(Stringify(result));
|
|
2352
|
+
*/
|
|
216
2353
|
function Add(properties: object): string;
|
|
2354
|
+
/**
|
|
2355
|
+
* 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.
|
|
2356
|
+
*
|
|
2357
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
|
|
2358
|
+
*
|
|
2359
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2360
|
+
* @param filter - Optional WSProxy-style filter object to narrow the results.
|
|
2361
|
+
* @returns List of subscriber objects on the list (filtered when a filter is supplied).
|
|
2362
|
+
* @example
|
|
2363
|
+
* Platform.Load("core", "1");
|
|
2364
|
+
* var list = List.Init("MY_LIST_KEY");
|
|
2365
|
+
* var subscribers = list.Subscribers.Retrieve();
|
|
2366
|
+
*/
|
|
217
2367
|
function Retrieve(filter?: object): object[];
|
|
2368
|
+
/**
|
|
2369
|
+
* Removes the specified subscriber from the previously initialized list.
|
|
2370
|
+
*
|
|
2371
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
|
|
2372
|
+
*
|
|
2373
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2374
|
+
* @param emailAddress - Email address of the subscriber, or a `{EmailAddress, SubscriberKey}` object identifying the subscriber.
|
|
2375
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2376
|
+
* @example
|
|
2377
|
+
* Platform.Load("core", "1.1.5");
|
|
2378
|
+
* var myList = List.Init("myList");
|
|
2379
|
+
* var status = myList.Subscribers.Unsubscribe("aruiz@example.com");
|
|
2380
|
+
*/
|
|
218
2381
|
function Unsubscribe(emailAddress: string): string;
|
|
2382
|
+
/**
|
|
2383
|
+
* Updates the status of the specified subscriber on the previously initialized list.
|
|
2384
|
+
*
|
|
2385
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
|
|
2386
|
+
*
|
|
2387
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2388
|
+
* @param emailAddress - Email address of the subscriber, or a `{EmailAddress, SubscriberKey}` object identifying the subscriber.
|
|
2389
|
+
* @param status - New status of the subscriber on the list.
|
|
2390
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2391
|
+
* @example
|
|
2392
|
+
* Platform.Load("core", "1.1.5");
|
|
2393
|
+
* var myList = List.Init("myList");
|
|
2394
|
+
* var status = myList.Subscribers.Update("aruiz@example.com", "Active");
|
|
2395
|
+
*/
|
|
219
2396
|
function Update(emailAddress: string, status: string): string;
|
|
2397
|
+
/**
|
|
2398
|
+
* 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.
|
|
2399
|
+
*
|
|
2400
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
|
|
2401
|
+
*
|
|
2402
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2403
|
+
* @param emailAddress - Email address of the subscriber, or a `{EmailAddress, SubscriberKey}` object identifying the subscriber.
|
|
2404
|
+
* @param attributes - Additional subscriber attributes to set or update.
|
|
2405
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2406
|
+
* @example
|
|
2407
|
+
* Platform.Load("core", "1.1.5");
|
|
2408
|
+
* var myList = List.Init("myList");
|
|
2409
|
+
* var status = myList.Subscribers.Upsert("aruiz@example.com", { ZipCode: "46202" });
|
|
2410
|
+
*/
|
|
220
2411
|
function Upsert(emailAddress: string, attributes: object): string;
|
|
221
2412
|
}
|
|
222
2413
|
declare namespace List.Subscribers.Tracking {
|
|
2414
|
+
/**
|
|
2415
|
+
* Returns an array of tracking data for subscribers matching the filter.
|
|
2416
|
+
*
|
|
2417
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
|
|
2418
|
+
*
|
|
2419
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2420
|
+
* @param filter - PascalCase WSProxy-style filter object identifying the subscribers.
|
|
2421
|
+
* @returns List of tracking records matching the filter.
|
|
2422
|
+
* @example
|
|
2423
|
+
* Platform.Load("core", "1.1.5");
|
|
2424
|
+
* var myList = List.Init("MyList");
|
|
2425
|
+
* var results = myList.Subscribers.Tracking.Retrieve({ Property: "SubscriberKey", SimpleOperator: "equals", Value: "MyKey" });
|
|
2426
|
+
*/
|
|
223
2427
|
function Retrieve(filter: object): object[];
|
|
224
2428
|
}
|
|
225
2429
|
declare namespace Subscriber {
|
|
2430
|
+
/**
|
|
2431
|
+
* Initializes a Subscriber instance bound to the specified subscriber key. Required before invoking any instance method on the returned object.
|
|
2432
|
+
*
|
|
2433
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2434
|
+
*
|
|
2435
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2436
|
+
* @param key - Subscriber key.
|
|
2437
|
+
* @returns An initialized Subscriber bound to the specified key.
|
|
2438
|
+
* @example
|
|
2439
|
+
* Platform.Load("core", "1");
|
|
2440
|
+
* var sub = Subscriber.Init("mySubscriber");
|
|
2441
|
+
*/
|
|
226
2442
|
function Init(key: string): any;
|
|
2443
|
+
/**
|
|
2444
|
+
* Creates a new subscriber from the supplied properties.
|
|
2445
|
+
*
|
|
2446
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2447
|
+
*
|
|
2448
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2449
|
+
* @param properties - JSON object describing the new subscriber (EmailAddress, SubscriberKey, EmailTypePreference, Attributes, Lists, ...).
|
|
2450
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2451
|
+
* @example
|
|
2452
|
+
* Platform.Load("core", "1.1.5");
|
|
2453
|
+
* var newSubscriber = {
|
|
2454
|
+
* EmailAddress: "test.008@example.com",
|
|
2455
|
+
* SubscriberKey: "20100730001",
|
|
2456
|
+
* EmailTypePreference: "Text",
|
|
2457
|
+
* Attributes: { "First Name": "test.008", "Last Name": "test.008" },
|
|
2458
|
+
* Lists: { Status: "Active", ID: 12345, Action: "Create" }
|
|
2459
|
+
* };
|
|
2460
|
+
* var status = Subscriber.Add(newSubscriber);
|
|
2461
|
+
*/
|
|
227
2462
|
function Add(properties: object): string;
|
|
2463
|
+
/**
|
|
2464
|
+
* Returns an array of subscribers matching the specified filter.
|
|
2465
|
+
*
|
|
2466
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2467
|
+
*
|
|
2468
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2469
|
+
* @param filter - PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
2470
|
+
* @returns List of subscribers matching the filter.
|
|
2471
|
+
* @example
|
|
2472
|
+
* Platform.Load("core", "1.1.5");
|
|
2473
|
+
* var results = Subscriber.Retrieve({ Property: "SubscriberKey", SimpleOperator: "equals", Value: "MySubscriberKey" });
|
|
2474
|
+
*/
|
|
228
2475
|
function Retrieve(filter: object): object[];
|
|
2476
|
+
/**
|
|
2477
|
+
* Creates a new subscriber, or updates an existing one matched by EmailAddress / SubscriberKey.
|
|
2478
|
+
*
|
|
2479
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2480
|
+
*
|
|
2481
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2482
|
+
* @param properties - JSON object describing the subscriber (EmailAddress, SubscriberKey, Attributes, ...).
|
|
2483
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2484
|
+
* @example
|
|
2485
|
+
* Platform.Load("core", "1");
|
|
2486
|
+
* var sub = {
|
|
2487
|
+
* EmailAddress: "test@example.com",
|
|
2488
|
+
* SubscriberKey: "test@example.com",
|
|
2489
|
+
* Attributes: [ { Name: "FirstName", Value: "Jane" } ]
|
|
2490
|
+
* };
|
|
2491
|
+
* var result = Subscriber.Upsert(sub);
|
|
2492
|
+
* Write(Stringify(result));
|
|
2493
|
+
*/
|
|
229
2494
|
function Upsert(properties: object): string;
|
|
2495
|
+
/**
|
|
2496
|
+
* Retrieves statistical data for the specified subscriber (sends, opens, clicks, bounces, unsubscribes).
|
|
2497
|
+
*
|
|
2498
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2499
|
+
*
|
|
2500
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2501
|
+
* @param subscriberKey - The subscriber key identifying the subscriber.
|
|
2502
|
+
* @returns A single object with subscriber statistics (not an array).
|
|
2503
|
+
* @example
|
|
2504
|
+
* Platform.Load("core", "1");
|
|
2505
|
+
* var stats = Subscriber.Statistics("test@example.com");
|
|
2506
|
+
* Write(Stringify(stats));
|
|
2507
|
+
*/
|
|
230
2508
|
function Statistics(subscriberKey: string): object;
|
|
2509
|
+
/**
|
|
2510
|
+
* Updates the previously initialized subscriber with the supplied attributes.
|
|
2511
|
+
*
|
|
2512
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2513
|
+
*
|
|
2514
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2515
|
+
* @param properties - Subscriber properties to change.
|
|
2516
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2517
|
+
* @example
|
|
2518
|
+
* Platform.Load("core", "1.1.5");
|
|
2519
|
+
* var subObj = Subscriber.Init("SubKey");
|
|
2520
|
+
* var status = subObj.Update({ EmailTypePreference: "HTML", Attributes: { "First Name": "Test", "Last Name": "User" } });
|
|
2521
|
+
*/
|
|
231
2522
|
function Update(properties: object): string;
|
|
2523
|
+
/**
|
|
2524
|
+
* Deletes the previously initialized subscriber.
|
|
2525
|
+
*
|
|
2526
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2527
|
+
*
|
|
2528
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2529
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2530
|
+
* @example
|
|
2531
|
+
* Platform.Load("core", "1.1.5");
|
|
2532
|
+
* var subObj = Subscriber.Init("SubKey");
|
|
2533
|
+
* var status = subObj.Remove();
|
|
2534
|
+
*/
|
|
232
2535
|
function Remove(): string;
|
|
2536
|
+
/**
|
|
2537
|
+
* Sets the previously initialized subscriber's status to `"Unsubscribed"`.
|
|
2538
|
+
*
|
|
2539
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2540
|
+
*
|
|
2541
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2542
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2543
|
+
* @example
|
|
2544
|
+
* Platform.Load("core", "1.1.5");
|
|
2545
|
+
* var subObj = Subscriber.Init("SubKey");
|
|
2546
|
+
* var status = subObj.Unsubscribe();
|
|
2547
|
+
*/
|
|
233
2548
|
function Unsubscribe(): string;
|
|
234
2549
|
}
|
|
235
2550
|
declare namespace Subscriber.Attributes {
|
|
2551
|
+
/**
|
|
2552
|
+
* Returns an array of attributes associated with the previously initialized subscriber.
|
|
2553
|
+
*
|
|
2554
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2555
|
+
*
|
|
2556
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2557
|
+
* @returns List of attribute objects for the subscriber.
|
|
2558
|
+
* @example
|
|
2559
|
+
* Platform.Load("core", "1.1.5");
|
|
2560
|
+
* var subObj = Subscriber.Init("SubKey");
|
|
2561
|
+
* var attributes = subObj.Attributes.Retrieve();
|
|
2562
|
+
*/
|
|
236
2563
|
function Retrieve(): object[];
|
|
237
2564
|
}
|
|
238
2565
|
declare namespace Subscriber.Lists {
|
|
2566
|
+
/**
|
|
2567
|
+
* Returns the lists the previously initialized subscriber is a member of.
|
|
2568
|
+
*
|
|
2569
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2570
|
+
*
|
|
2571
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2572
|
+
* @returns List of list objects the subscriber belongs to.
|
|
2573
|
+
* @example
|
|
2574
|
+
* Platform.Load("core", "1.1.5");
|
|
2575
|
+
* var subObj = Subscriber.Init("SubKey");
|
|
2576
|
+
* var listArray = subObj.Lists.Retrieve();
|
|
2577
|
+
*/
|
|
239
2578
|
function Retrieve(): object[];
|
|
240
2579
|
}
|
|
241
2580
|
declare namespace Email {
|
|
2581
|
+
/**
|
|
2582
|
+
* 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()`.
|
|
2583
|
+
*
|
|
2584
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2585
|
+
*
|
|
2586
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2587
|
+
* @param key - External key of the email message.
|
|
2588
|
+
* @returns An initialized Email bound to the specified external key.
|
|
2589
|
+
* @example
|
|
2590
|
+
* Platform.Load("core", "1");
|
|
2591
|
+
* var myEmail = Email.Init("myEmail");
|
|
2592
|
+
*/
|
|
242
2593
|
function Init(key: string): any;
|
|
2594
|
+
/**
|
|
2595
|
+
* 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"`.
|
|
2596
|
+
*
|
|
2597
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2598
|
+
*
|
|
2599
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2600
|
+
* @param properties - JSON object describing the new email (CustomerKey, Name, optional CategoryID, HTMLBody, TextBody, Subject, EmailType, ...).
|
|
2601
|
+
* @returns An initialized Email bound to the newly-created email message.
|
|
2602
|
+
* @example
|
|
2603
|
+
* Platform.Load("core", "1.1.5");
|
|
2604
|
+
* var newMail = {
|
|
2605
|
+
* CustomerKey: "test_email_key",
|
|
2606
|
+
* Name: "Test Email",
|
|
2607
|
+
* HTMLBody: "<b>This is a test email</b>",
|
|
2608
|
+
* TextBody: "This is a test email",
|
|
2609
|
+
* Subject: "Test Email Subject",
|
|
2610
|
+
* EmailType: "HTML",
|
|
2611
|
+
* CharacterSet: "US-ASCII"
|
|
2612
|
+
* };
|
|
2613
|
+
* var myEmail = Email.Add(newMail);
|
|
2614
|
+
*/
|
|
243
2615
|
function Add(properties: object): any;
|
|
2616
|
+
/**
|
|
2617
|
+
* Returns an array of email messages matching the specified filter.
|
|
2618
|
+
*
|
|
2619
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2620
|
+
*
|
|
2621
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2622
|
+
* @param filter - PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
2623
|
+
* @returns List of email messages matching the filter.
|
|
2624
|
+
* @example
|
|
2625
|
+
* Platform.Load("core", "1.1.5");
|
|
2626
|
+
* var results = Email.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "myEmail" });
|
|
2627
|
+
*/
|
|
244
2628
|
function Retrieve(filter: object): object[];
|
|
2629
|
+
/**
|
|
2630
|
+
* Updates the email message with the supplied attributes.
|
|
2631
|
+
*
|
|
2632
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2633
|
+
*
|
|
2634
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2635
|
+
* @param properties - Attributes to change on the email message.
|
|
2636
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2637
|
+
* @example
|
|
2638
|
+
* Platform.Load("core", "1.1.5");
|
|
2639
|
+
* var myEmail = Email.Init("myEmail");
|
|
2640
|
+
* var status = myEmail.Update({ Name: "Updated Name", Subject: "Updated Email Subject" });
|
|
2641
|
+
*/
|
|
245
2642
|
function Update(properties: object): string;
|
|
2643
|
+
/**
|
|
2644
|
+
* Removes the previously initialized email message.
|
|
2645
|
+
*
|
|
2646
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2647
|
+
*
|
|
2648
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2649
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2650
|
+
* @example
|
|
2651
|
+
* Platform.Load("core", "1.1.5");
|
|
2652
|
+
* var myEmail = Email.Init("myEmail");
|
|
2653
|
+
* myEmail.Remove();
|
|
2654
|
+
*/
|
|
246
2655
|
function Remove(): string;
|
|
2656
|
+
/**
|
|
2657
|
+
* Runs validation checks on the previously initialized email message. Returns a `{Task: {ValidationStatus: boolean, ValidationMessages: string}}` object.
|
|
2658
|
+
*
|
|
2659
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2660
|
+
*
|
|
2661
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2662
|
+
* @returns Validation result with `Task.ValidationStatus` (boolean) and `Task.ValidationMessages` (string).
|
|
2663
|
+
* @example
|
|
2664
|
+
* Platform.Load("core", "1.1.5");
|
|
2665
|
+
* var myEmail = Email.Init("myEmail");
|
|
2666
|
+
* var results = myEmail.Validate();
|
|
2667
|
+
* Write(results.Task.ValidationStatus);
|
|
2668
|
+
* Write(results.Task.ValidationMessages);
|
|
2669
|
+
*/
|
|
247
2670
|
function Validate(): object;
|
|
2671
|
+
/**
|
|
2672
|
+
* Runs content checks on the previously initialized email message. Returns a `{Task: {CheckPassed: boolean, ResultMessage: string}}` object.
|
|
2673
|
+
*
|
|
2674
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2675
|
+
*
|
|
2676
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2677
|
+
* @returns Content-check result with `Task.CheckPassed` (boolean) and `Task.ResultMessage` (string).
|
|
2678
|
+
* @example
|
|
2679
|
+
* Platform.Load("core", "1.1.5");
|
|
2680
|
+
* var myEmail = Email.Init("myEmail");
|
|
2681
|
+
* var results = myEmail.CheckContent();
|
|
2682
|
+
* Write(results.Task.CheckPassed);
|
|
2683
|
+
* Write(results.Task.ResultMessage);
|
|
2684
|
+
*/
|
|
248
2685
|
function CheckContent(): object;
|
|
249
2686
|
}
|
|
250
2687
|
declare namespace Send {
|
|
2688
|
+
/**
|
|
2689
|
+
* Initializes a Send instance bound to the specified send ID. Required before invoking any other Send method on the returned instance.
|
|
2690
|
+
*
|
|
2691
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2692
|
+
*
|
|
2693
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2694
|
+
* @param id - Numeric ID of the send.
|
|
2695
|
+
* @returns An initialized Send bound to the specified send ID.
|
|
2696
|
+
* @example
|
|
2697
|
+
* Platform.Load("core", "1");
|
|
2698
|
+
* var s = Send.Init(12345);
|
|
2699
|
+
*/
|
|
251
2700
|
function Init(id: number): any;
|
|
2701
|
+
/**
|
|
2702
|
+
* 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.
|
|
2703
|
+
*
|
|
2704
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2705
|
+
*
|
|
2706
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2707
|
+
* @param emailKey - CustomerKey of the email message to associate with the send.
|
|
2708
|
+
* @param listIds - Array of list IDs to send to.
|
|
2709
|
+
* @param options - Optional send options (FromName, FromAddress, Subject, send time, ...).
|
|
2710
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2711
|
+
* @example
|
|
2712
|
+
* Platform.Load("core", "1.1.5");
|
|
2713
|
+
* var status = Send.Add("test_email", [12345, 12346]);
|
|
2714
|
+
* var options = { FromName: "JSON Specified Name", FromAddress: "aruiz@example.com", Subject: "JSON Test Mail" };
|
|
2715
|
+
* var status2 = Send.Add("test_email", [12345, 12346], options);
|
|
2716
|
+
*/
|
|
252
2717
|
function Add(emailKey: string, listIds: any[], options?: object): string;
|
|
2718
|
+
/**
|
|
2719
|
+
* Returns an array of sends matching the specified filter.
|
|
2720
|
+
*
|
|
2721
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2722
|
+
*
|
|
2723
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2724
|
+
* @param filter - PascalCase WSProxy-style filter object — simple or compound with `LeftOperand`/`LogicalOperator`/`RightOperand`.
|
|
2725
|
+
* @returns List of sends matching the filter.
|
|
2726
|
+
* @example
|
|
2727
|
+
* Platform.Load("core", "1.1.5");
|
|
2728
|
+
* var sends = Send.Retrieve({ Property: "ID", SimpleOperator: "equals", Value: 12345 });
|
|
2729
|
+
*/
|
|
253
2730
|
function Retrieve(filter: object): object[];
|
|
2731
|
+
/**
|
|
2732
|
+
* Returns information about the lists targeted by a send. Filter must restrict results to specific send ID(s).
|
|
2733
|
+
*
|
|
2734
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2735
|
+
*
|
|
2736
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2737
|
+
* @param filter - WSProxy-style filter restricting results to specific send ID(s).
|
|
2738
|
+
* @returns List of list objects associated with matching sends; throws on failure.
|
|
2739
|
+
* @example
|
|
2740
|
+
* Platform.Load("core", "1.1.5");
|
|
2741
|
+
* var listsSentTo = Send.RetrieveLists({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
2742
|
+
*/
|
|
254
2743
|
function RetrieveLists(filter: object): object[];
|
|
2744
|
+
/**
|
|
2745
|
+
* Removes the previously initialized send.
|
|
2746
|
+
*
|
|
2747
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2748
|
+
*
|
|
2749
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2750
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2751
|
+
* @example
|
|
2752
|
+
* Platform.Load("core", "1.1.5");
|
|
2753
|
+
* var s = Send.Init(12345);
|
|
2754
|
+
* s.Remove();
|
|
2755
|
+
*/
|
|
255
2756
|
function Remove(): string;
|
|
2757
|
+
/**
|
|
2758
|
+
* Attempts to cancel the previously initialized send.
|
|
2759
|
+
*
|
|
2760
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2761
|
+
*
|
|
2762
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2763
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2764
|
+
* @example
|
|
2765
|
+
* Platform.Load("core", "1.1.5");
|
|
2766
|
+
* var mySend = Send.Init(12345);
|
|
2767
|
+
* var status = mySend.CancelSend();
|
|
2768
|
+
*/
|
|
256
2769
|
function CancelSend(): string;
|
|
257
2770
|
}
|
|
258
2771
|
declare namespace Send.Tracking {
|
|
2772
|
+
/**
|
|
2773
|
+
* Returns tracking data for sends matching the filter. This is a static call on `Send.Tracking.*` — no `Send.Init()` is required.
|
|
2774
|
+
*
|
|
2775
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2776
|
+
*
|
|
2777
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2778
|
+
* @param filter - WSProxy-style filter object.
|
|
2779
|
+
* @returns List of tracking records matching the filter.
|
|
2780
|
+
* @example
|
|
2781
|
+
* Platform.Load("core", "1.1.5");
|
|
2782
|
+
* var sendTracking = Send.Tracking.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
2783
|
+
*/
|
|
259
2784
|
function Retrieve(filter: object): object[];
|
|
2785
|
+
/**
|
|
2786
|
+
* Returns click tracking data for the previously initialized send.
|
|
2787
|
+
*
|
|
2788
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2789
|
+
*
|
|
2790
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2791
|
+
* @param filter - WSProxy-style filter restricting results.
|
|
2792
|
+
* @returns List of click tracking records matching the filter.
|
|
2793
|
+
* @example
|
|
2794
|
+
* Platform.Load("core", "1.1.5");
|
|
2795
|
+
* var singleSend = Send.Init(12345);
|
|
2796
|
+
* var results = singleSend.Tracking.ClickRetrieve({ Property: "ID", SimpleOperator: "equals", Value: 12345 });
|
|
2797
|
+
*/
|
|
260
2798
|
function ClickRetrieve(filter: object): object[];
|
|
2799
|
+
/**
|
|
2800
|
+
* Returns aggregated tracking data for the previously initialized send. Aggregates by `type` over the date range, grouped by `groupBy`.
|
|
2801
|
+
*
|
|
2802
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2803
|
+
*
|
|
2804
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2805
|
+
* @param type - Type of data to aggregate.
|
|
2806
|
+
* @param startDate - Start date of the data period (MM-DD-YYYY).
|
|
2807
|
+
* @param endDate - End date of the data period (MM-DD-YYYY).
|
|
2808
|
+
* @param groupBy - Interval used to aggregate data.
|
|
2809
|
+
* @returns List of aggregated tracking records.
|
|
2810
|
+
* @example
|
|
2811
|
+
* Platform.Load("core", "1.1.5");
|
|
2812
|
+
* var singleSend = Send.Init(12345);
|
|
2813
|
+
* var results = singleSend.Tracking.TotalByIntervalRetrieve("Click", "07-01-2010", "07-31-2010", "day");
|
|
2814
|
+
*/
|
|
261
2815
|
function TotalByIntervalRetrieve(type: string, startDate: string, endDate: string, groupBy: string): object[];
|
|
262
2816
|
}
|
|
263
2817
|
declare namespace Send.Definition {
|
|
2818
|
+
/**
|
|
2819
|
+
* Initializes a SendDefinition instance bound to the specified external key. Required before invoking any instance method on the returned object.
|
|
2820
|
+
*
|
|
2821
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2822
|
+
*
|
|
2823
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2824
|
+
* @param key - External key of the send definition.
|
|
2825
|
+
* @returns An initialized SendDefinition bound to the specified external key.
|
|
2826
|
+
* @example
|
|
2827
|
+
* Platform.Load("core", "1.1.5");
|
|
2828
|
+
* var esd = Send.Definition.Init("myESD");
|
|
2829
|
+
*/
|
|
264
2830
|
function Init(key: string): any;
|
|
2831
|
+
/**
|
|
2832
|
+
* Creates a new send definition.
|
|
2833
|
+
*
|
|
2834
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2835
|
+
*
|
|
2836
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2837
|
+
* @param esdParams - Object with CustomerKey, Name, EmailSubject for the new send definition.
|
|
2838
|
+
* @param sendClassificationKey - CustomerKey of the related send classification.
|
|
2839
|
+
* @param emailKey - CustomerKey of the email message to use.
|
|
2840
|
+
* @param listIds - Array of list IDs targeted by the send definition.
|
|
2841
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2842
|
+
* @example
|
|
2843
|
+
* Platform.Load("core", "1");
|
|
2844
|
+
* var esdParams = { CustomerKey: "example_esd", Name: "Example Send Definition", EmailSubject: "Sent By Example Send Definition" };
|
|
2845
|
+
* Send.Definition.Add(esdParams, "example_sc_key", "example_email_key", [12345, 12346]);
|
|
2846
|
+
*/
|
|
265
2847
|
function Add(esdParams: object, sendClassificationKey: string, emailKey: string, listIds: any[]): string;
|
|
2848
|
+
/**
|
|
2849
|
+
* Creates a new send definition that targets a sendable Data Extension.
|
|
2850
|
+
*
|
|
2851
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2852
|
+
*
|
|
2853
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2854
|
+
* @param esdParams - Object with CustomerKey, Name, EmailSubject for the new send definition.
|
|
2855
|
+
* @param sendClassificationKey - CustomerKey of the related send classification.
|
|
2856
|
+
* @param emailKey - CustomerKey of the email message to use.
|
|
2857
|
+
* @param sendableDataExtensionKey - CustomerKey of the sendable Data Extension.
|
|
2858
|
+
* @param publicationListKey - CustomerKey of the publication list to associate.
|
|
2859
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2860
|
+
* @example
|
|
2861
|
+
* Platform.Load("core", "1.1.5");
|
|
2862
|
+
* var esdParams = { CustomerKey: "ssjs_de_esd_1c", Name: "SSJS DE Test ESD3", EmailSubject: "Third send By Test DE Send Definition" };
|
|
2863
|
+
* var status = Send.Definition.AddWithDE(esdParams, "scKey", "test_email", "deKey", "myPubList");
|
|
2864
|
+
*/
|
|
266
2865
|
function AddWithDE(esdParams: object, sendClassificationKey: string, emailKey: string, sendableDataExtensionKey: string, publicationListKey: string): string;
|
|
2866
|
+
/**
|
|
2867
|
+
* Creates a new send definition that targets the audience defined by a filter definition.
|
|
2868
|
+
*
|
|
2869
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2870
|
+
*
|
|
2871
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2872
|
+
* @param esdParams - Object with CustomerKey, Name, EmailSubject for the new send definition.
|
|
2873
|
+
* @param sendClassificationKey - CustomerKey of the related send classification.
|
|
2874
|
+
* @param emailKey - CustomerKey of the email message to use.
|
|
2875
|
+
* @param filterDefinitionKey - CustomerKey of the filter definition.
|
|
2876
|
+
* @param listId - ID of the list targeted by the filter.
|
|
2877
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2878
|
+
* @example
|
|
2879
|
+
* Platform.Load("core", "1.1.5");
|
|
2880
|
+
* var esdParams = { CustomerKey: "filterDef_esd", Name: "Example Filtered Send Definition", EmailSubject: "Sent By Filtered Send Definition" };
|
|
2881
|
+
* var status = Send.Definition.AddWithFilterDefinition(esdParams, "scKey", "test_email", "fdKey", 144);
|
|
2882
|
+
*/
|
|
267
2883
|
function AddWithFilterDefinition(esdParams: object, sendClassificationKey: string, emailKey: string, filterDefinitionKey: string, listId: number): string;
|
|
2884
|
+
/**
|
|
2885
|
+
* Returns an array of send definitions, optionally filtered. When no filter is supplied, all send definitions are returned.
|
|
2886
|
+
*
|
|
2887
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2888
|
+
*
|
|
2889
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2890
|
+
* @param filter - Optional WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
2891
|
+
* @returns List of send definitions matching the filter (or all when no filter is supplied).
|
|
2892
|
+
* @example
|
|
2893
|
+
* Platform.Load("core", "1.1.5");
|
|
2894
|
+
* var esd = Send.Definition.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "ssjs_test_esd" });
|
|
2895
|
+
*/
|
|
268
2896
|
function Retrieve(filter?: object): object[];
|
|
2897
|
+
/**
|
|
2898
|
+
* Updates the previously initialized send definition.
|
|
2899
|
+
*
|
|
2900
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2901
|
+
*
|
|
2902
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2903
|
+
* @param properties - Properties to update.
|
|
2904
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2905
|
+
* @example
|
|
2906
|
+
* Platform.Load("core", "1.1.5");
|
|
2907
|
+
* var sendDef = Send.Definition.Init("MY_SEND_DEF_KEY");
|
|
2908
|
+
* var result = sendDef.Update({ Name: "Updated Send Definition Name" });
|
|
2909
|
+
*/
|
|
269
2910
|
function Update(properties: object): string;
|
|
2911
|
+
/**
|
|
2912
|
+
* Deletes the previously initialized send definition.
|
|
2913
|
+
*
|
|
2914
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2915
|
+
*
|
|
2916
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2917
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2918
|
+
* @example
|
|
2919
|
+
* Platform.Load("core", "1.1.5");
|
|
2920
|
+
* var esd = Send.Definition.Init("myESD");
|
|
2921
|
+
* var status = esd.Remove();
|
|
2922
|
+
*/
|
|
270
2923
|
function Remove(): string;
|
|
2924
|
+
/**
|
|
2925
|
+
* Sends email messages to the lists associated with the previously initialized send definition.
|
|
2926
|
+
*
|
|
2927
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2928
|
+
*
|
|
2929
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2930
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2931
|
+
* @example
|
|
2932
|
+
* Platform.Load("core", "1.1.5");
|
|
2933
|
+
* var esd = Send.Definition.Init("myESD");
|
|
2934
|
+
* var status = esd.Send();
|
|
2935
|
+
*/
|
|
271
2936
|
function Send(): string;
|
|
272
2937
|
}
|
|
273
2938
|
declare namespace TriggeredSend {
|
|
2939
|
+
/**
|
|
2940
|
+
* 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.
|
|
2941
|
+
*
|
|
2942
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
2943
|
+
*
|
|
2944
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2945
|
+
* @param key - External key of the triggered send definition.
|
|
2946
|
+
* @returns An initialized TriggeredSend bound to the specified external key.
|
|
2947
|
+
* @example
|
|
2948
|
+
* Platform.Load("core", "1");
|
|
2949
|
+
* var triggeredSend = TriggeredSend.Init("support");
|
|
2950
|
+
*/
|
|
274
2951
|
function Init(key: string): any;
|
|
2952
|
+
/**
|
|
2953
|
+
* 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"`.
|
|
2954
|
+
*
|
|
2955
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
2956
|
+
*
|
|
2957
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2958
|
+
* @param properties - JSON object describing the new triggered send definition (Name, CustomerKey, FromName, FromAddress, EmailID, SendClassificationID, ...).
|
|
2959
|
+
* @returns An initialized TriggeredSend bound to the newly-created triggered send definition.
|
|
2960
|
+
* @example
|
|
2961
|
+
* Platform.Load("core", "1.1.5");
|
|
2962
|
+
* var newTSD = {
|
|
2963
|
+
* Name: "Test TSD",
|
|
2964
|
+
* CustomerKey: "ssjs_tsd_key",
|
|
2965
|
+
* FromName: "Test From Name",
|
|
2966
|
+
* FromAddress: "me@example.com",
|
|
2967
|
+
* EmailID: 12345,
|
|
2968
|
+
* SendClassificationID: 54321
|
|
2969
|
+
* };
|
|
2970
|
+
* var tsd = TriggeredSend.Add(newTSD);
|
|
2971
|
+
*/
|
|
275
2972
|
function Add(properties: object): any;
|
|
2973
|
+
/**
|
|
2974
|
+
* Returns an array of triggered send definitions matching the specified filter.
|
|
2975
|
+
*
|
|
2976
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
2977
|
+
*
|
|
2978
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2979
|
+
* @param filter - PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
2980
|
+
* @returns List of triggered send definitions matching the filter.
|
|
2981
|
+
* @example
|
|
2982
|
+
* Platform.Load("core", "1.1.5");
|
|
2983
|
+
* var results = TriggeredSend.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "ssjs_tsd_key" });
|
|
2984
|
+
*/
|
|
276
2985
|
function Retrieve(filter: object): object[];
|
|
2986
|
+
/**
|
|
2987
|
+
* Updates the previously initialized triggered send definition.
|
|
2988
|
+
*
|
|
2989
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
2990
|
+
*
|
|
2991
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
2992
|
+
* @param properties - Attributes to change on the triggered send definition.
|
|
2993
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
2994
|
+
* @example
|
|
2995
|
+
* Platform.Load("core", "1.1.5");
|
|
2996
|
+
* var tsd = TriggeredSend.Init("triggeredSend");
|
|
2997
|
+
* var status = tsd.Update({ Name: "Updated TSD Name" });
|
|
2998
|
+
*/
|
|
277
2999
|
function Update(properties: object): string;
|
|
3000
|
+
/**
|
|
3001
|
+
* Starts (reactivates) a paused triggered send definition.
|
|
3002
|
+
*
|
|
3003
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3004
|
+
*
|
|
3005
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3006
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
3007
|
+
* @example
|
|
3008
|
+
* Platform.Load("core", "1.1.5");
|
|
3009
|
+
* var ts = TriggeredSend.Init("MY_TRIGGERED_SEND_KEY");
|
|
3010
|
+
* var result = ts.Start();
|
|
3011
|
+
*/
|
|
278
3012
|
function Start(): string;
|
|
3013
|
+
/**
|
|
3014
|
+
* Pauses an active triggered send definition.
|
|
3015
|
+
*
|
|
3016
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3017
|
+
*
|
|
3018
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3019
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
3020
|
+
* @example
|
|
3021
|
+
* Platform.Load("core", "1.1.5");
|
|
3022
|
+
* var ts = TriggeredSend.Init("MY_TRIGGERED_SEND_KEY");
|
|
3023
|
+
* var status = ts.Pause();
|
|
3024
|
+
*/
|
|
279
3025
|
function Pause(): string;
|
|
3026
|
+
/**
|
|
3027
|
+
* Publishes a triggered send definition, making it active and ready to accept sends. Use this to move a definition from Draft / Inactive to Active.
|
|
3028
|
+
*
|
|
3029
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3030
|
+
*
|
|
3031
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3032
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
3033
|
+
* @example
|
|
3034
|
+
* Platform.Load("core", "1.1.5");
|
|
3035
|
+
* var ts = TriggeredSend.Init("MY_TRIGGERED_SEND_KEY");
|
|
3036
|
+
* var result = ts.Publish();
|
|
3037
|
+
*/
|
|
280
3038
|
function Publish(): string;
|
|
3039
|
+
/**
|
|
3040
|
+
* Sends an email using the previously initialized triggered send definition. On failure, inspect `<TriggeredSendInstance>.LastMessage` for error details.
|
|
3041
|
+
*
|
|
3042
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3043
|
+
*
|
|
3044
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3045
|
+
* @param emailAddress - Email address to send to. SubscriberKey is **not** supported.
|
|
3046
|
+
* @param sendTimeAttributes - Optional object with dynamic attributes to include in the send.
|
|
3047
|
+
* @returns Returns "OK" on success or "Error"; throws on a hard failure.
|
|
3048
|
+
* @example
|
|
3049
|
+
* Platform.Load("core", "1.1.5");
|
|
3050
|
+
* var ts = TriggeredSend.Init("triggeredSend");
|
|
3051
|
+
* var status = ts.Send("aruiz@example.com", { FirstName: "Angel", CouponCode: "AA1AF" });
|
|
3052
|
+
* if (status != "OK") { var message = ts.LastMessage; }
|
|
3053
|
+
*/
|
|
281
3054
|
function Send(emailAddress: string, sendTimeAttributes?: object): string;
|
|
282
3055
|
}
|
|
283
3056
|
declare namespace TriggeredSend.Tracking {
|
|
3057
|
+
/**
|
|
3058
|
+
* Returns tracking data for the previously initialized triggered send definition.
|
|
3059
|
+
*
|
|
3060
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3061
|
+
*
|
|
3062
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3063
|
+
* @param filter - Optional WSProxy-style filter object.
|
|
3064
|
+
* @returns List of tracking records.
|
|
3065
|
+
* @example
|
|
3066
|
+
* Platform.Load("core", "1.1.5");
|
|
3067
|
+
* var tsd = TriggeredSend.Init("MyTSDKey");
|
|
3068
|
+
* var tsdTracking = tsd.Tracking.Retrieve();
|
|
3069
|
+
*/
|
|
284
3070
|
function Retrieve(filter?: object): object[];
|
|
285
3071
|
}
|
|
286
3072
|
declare namespace TriggeredSend.Tracking.Clicks {
|
|
3073
|
+
/**
|
|
3074
|
+
* Returns click tracking information for the previously initialized triggered send definition.
|
|
3075
|
+
*
|
|
3076
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3077
|
+
*
|
|
3078
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3079
|
+
* @param filter - WSProxy-style filter restricting click results.
|
|
3080
|
+
* @returns List of click tracking records matching the filter.
|
|
3081
|
+
* @example
|
|
3082
|
+
* Platform.Load("core", "1.1.5");
|
|
3083
|
+
* var tsd = TriggeredSend.Init("MyTSDKey");
|
|
3084
|
+
* var results = tsd.Tracking.Clicks.Retrieve({ Property: "SendUrlID", SimpleOperator: "equals", Value: 12345 });
|
|
3085
|
+
*/
|
|
287
3086
|
function Retrieve(filter: object): object[];
|
|
288
3087
|
}
|
|
289
3088
|
declare namespace TriggeredSend.Tracking.TotalByInterval {
|
|
3089
|
+
/**
|
|
3090
|
+
* Returns aggregated tracking data for the previously initialized triggered send. Aggregates by `type` over the date range, grouped by `groupBy`.
|
|
3091
|
+
*
|
|
3092
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3093
|
+
*
|
|
3094
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3095
|
+
* @param type - Type of data to aggregate.
|
|
3096
|
+
* @param startDate - Start date of the data period (MM-DD-YYYY).
|
|
3097
|
+
* @param endDate - End date of the data period (MM-DD-YYYY).
|
|
3098
|
+
* @param groupBy - Interval used to aggregate data.
|
|
3099
|
+
* @returns List of aggregated tracking records.
|
|
3100
|
+
* @example
|
|
3101
|
+
* Platform.Load("core", "1.1.5");
|
|
3102
|
+
* var tsd = TriggeredSend.Init("MyTSDKey");
|
|
3103
|
+
* var results = tsd.Tracking.TotalByInterval.Retrieve("Click", "07-01-2010", "07-31-2010", "day");
|
|
3104
|
+
*/
|
|
290
3105
|
function Retrieve(type: string, startDate: string, endDate: string, groupBy: string): object[];
|
|
291
3106
|
}
|
|
292
3107
|
declare namespace DataExtension {
|
|
3108
|
+
/**
|
|
3109
|
+
* 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.
|
|
3110
|
+
*
|
|
3111
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension/)
|
|
3112
|
+
*
|
|
3113
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3114
|
+
* @param key - External key of the data extension.
|
|
3115
|
+
* @returns An initialized DataExtension bound to the specified external key.
|
|
3116
|
+
* @example
|
|
3117
|
+
* Platform.Load("core", "1.1.5");
|
|
3118
|
+
* var birthdayDE = DataExtension.Init("birthdayDE");
|
|
3119
|
+
*/
|
|
293
3120
|
function Init(key: string): DataExtensionInstance;
|
|
3121
|
+
/**
|
|
3122
|
+
* 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"`.
|
|
3123
|
+
*
|
|
3124
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension/)
|
|
3125
|
+
*
|
|
3126
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3127
|
+
* @param properties - JSON object describing the new data extension (CustomerKey, Name, Fields[], optional SendableInfo).
|
|
3128
|
+
* @returns An initialized DataExtension bound to the newly-created data extension.
|
|
3129
|
+
* @example
|
|
3130
|
+
* Platform.Load("core", "1.1.5");
|
|
3131
|
+
* var deObj = {
|
|
3132
|
+
* CustomerKey: "SendableDE",
|
|
3133
|
+
* Name: "Sendable Data Extension",
|
|
3134
|
+
* Fields: [
|
|
3135
|
+
* { Name: "SubKey", FieldType: "Text", IsPrimaryKey: true, MaxLength: 50, IsRequired: true },
|
|
3136
|
+
* { Name: "SecondField", FieldType: "Text", MaxLength: 50 }
|
|
3137
|
+
* ],
|
|
3138
|
+
* SendableInfo: {
|
|
3139
|
+
* Field: { Name: "SubKey", FieldType: "Text" },
|
|
3140
|
+
* RelatesOn: "Subscriber Key"
|
|
3141
|
+
* }
|
|
3142
|
+
* };
|
|
3143
|
+
* var de = DataExtension.Add(deObj);
|
|
3144
|
+
*/
|
|
294
3145
|
function Add(properties: object): DataExtensionInstance;
|
|
3146
|
+
/**
|
|
3147
|
+
* Returns an array of data extensions matching the specified filter. Pass `queryAllAccounts: true` to search all accounts accessible to the authenticated user.
|
|
3148
|
+
*
|
|
3149
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension/)
|
|
3150
|
+
*
|
|
3151
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3152
|
+
* @param filter - PascalCase WSProxy-style filter object: `{Property, SimpleOperator, Value}`.
|
|
3153
|
+
* @param queryAllAccounts - When `true`, search across all accounts accessible to the authenticated user. Defaults to `false`.
|
|
3154
|
+
* @returns List of data extensions matching the filter. Limit data extension external keys to 36 characters for downstream compatibility.
|
|
3155
|
+
* @example
|
|
3156
|
+
* Platform.Load("core", "1.1.5");
|
|
3157
|
+
* var results = DataExtension.Retrieve({ Property: "CustomerKey", SimpleOperator: "equals", Value: "myDEKey" });
|
|
3158
|
+
*/
|
|
295
3159
|
function Retrieve(filter: object, queryAllAccounts?: boolean): object[];
|
|
296
3160
|
}
|
|
297
3161
|
declare namespace DataExtension.Fields {
|
|
3162
|
+
/**
|
|
3163
|
+
* 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'.
|
|
3164
|
+
*
|
|
3165
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
|
|
3166
|
+
*
|
|
3167
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3168
|
+
* @param properties - Object describing the new field.
|
|
3169
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
3170
|
+
* @example
|
|
3171
|
+
* Platform.Load("core", "1.1.5");
|
|
3172
|
+
* var de = DataExtension.Init("SSJSTest");
|
|
3173
|
+
* var newField = { Name: "NewFieldV2", CustomerKey: "CustomerKey", FieldType: "Number", IsRequired: true, DefaultValue: "100" };
|
|
3174
|
+
* var status = de.Fields.Add(newField);
|
|
3175
|
+
*/
|
|
298
3176
|
function Add(properties: object): string;
|
|
3177
|
+
/**
|
|
3178
|
+
* Returns an array of field definitions for the previously initialized data extension.
|
|
3179
|
+
*
|
|
3180
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
|
|
3181
|
+
*
|
|
3182
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3183
|
+
* @returns List of field-definition objects.
|
|
3184
|
+
* @example
|
|
3185
|
+
* Platform.Load("core", "1.1.5");
|
|
3186
|
+
* var birthdayDE = DataExtension.Init("birthdayDE");
|
|
3187
|
+
* var fields = birthdayDE.Fields.Retrieve();
|
|
3188
|
+
*/
|
|
299
3189
|
function Retrieve(): object[];
|
|
3190
|
+
/**
|
|
3191
|
+
* 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.
|
|
3192
|
+
*
|
|
3193
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
|
|
3194
|
+
*
|
|
3195
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3196
|
+
* @param deFieldName - Name of the data extension field that should make the connection to the subscriber list.
|
|
3197
|
+
* @param subscriberField - Subscriber attribute to map the data extension field to.
|
|
3198
|
+
* @returns Returns "OK" on success or throws on failure (assumed; doc has no `@returns`, treated as `"OK"` for consistency with sibling `Fields.*` methods).
|
|
3199
|
+
* @example
|
|
3200
|
+
* Platform.Load("core", "1.1.5");
|
|
3201
|
+
* var updateDE = DataExtension.Init("sendableDataExtension");
|
|
3202
|
+
* var status = updateDE.Fields.UpdateSendableField("DifferentSubKey", "Subscriber Key");
|
|
3203
|
+
*/
|
|
300
3204
|
function UpdateSendableField(deFieldName: string, subscriberField: string): string;
|
|
301
3205
|
}
|
|
302
3206
|
declare namespace DataExtension.Rows {
|
|
3207
|
+
/**
|
|
3208
|
+
* Adds one or more rows to the previously initialized data extension.
|
|
3209
|
+
*
|
|
3210
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
|
|
3211
|
+
*
|
|
3212
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3213
|
+
* @param rowData - Array of objects, one per row to add. Each object's keys must match data extension field names.
|
|
3214
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
3215
|
+
* @example
|
|
3216
|
+
* Platform.Load("core", "1.1.5");
|
|
3217
|
+
* var arrContacts = [
|
|
3218
|
+
* { Email: "jdoe@example.com", FirstName: "John", LastName: "Doe" },
|
|
3219
|
+
* { Email: "aruiz@example.com", FirstName: "Angel", LastName: "Ruiz" }
|
|
3220
|
+
* ];
|
|
3221
|
+
* var birthdayDE = DataExtension.Init("birthdayDE");
|
|
3222
|
+
* birthdayDE.Rows.Add(arrContacts);
|
|
3223
|
+
*/
|
|
303
3224
|
function Add(rowData: any[]): string;
|
|
3225
|
+
/**
|
|
3226
|
+
* 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.
|
|
3227
|
+
*
|
|
3228
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
|
|
3229
|
+
*
|
|
3230
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3231
|
+
* @param searchFieldNames - Array of column names to match against.
|
|
3232
|
+
* @param searchValues - Array of values to match (one per column, in order).
|
|
3233
|
+
* @param limit - Maximum number of rows to return.
|
|
3234
|
+
* @param orderByFieldName - Field to order results by.
|
|
3235
|
+
* @returns Rows matching the lookup criteria.
|
|
3236
|
+
* @example
|
|
3237
|
+
* Platform.Load("core", "1.1.5");
|
|
3238
|
+
* var testDE = DataExtension.Init("testDE");
|
|
3239
|
+
* var data = testDE.Rows.Lookup(["Age"], [25], 2, "LastName");
|
|
3240
|
+
*/
|
|
304
3241
|
function Lookup(searchFieldNames: any[], searchValues: any[], limit?: number, orderByFieldName?: string): object[];
|
|
3242
|
+
/**
|
|
3243
|
+
* 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.
|
|
3244
|
+
*
|
|
3245
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
|
|
3246
|
+
*
|
|
3247
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3248
|
+
* @param columnNames - Array of column names to match against.
|
|
3249
|
+
* @param columnValues - Array of values to match (one per column, in order).
|
|
3250
|
+
* @returns The number of rows that were modified (deleted).
|
|
3251
|
+
* @example
|
|
3252
|
+
* Platform.Load("Core", "1.1.5");
|
|
3253
|
+
* var memberDE = DataExtension.Init("MembershipRewards");
|
|
3254
|
+
* var result = memberDE.Rows.Remove(["Area"], ["Kensington"]);
|
|
3255
|
+
*/
|
|
305
3256
|
function Remove(columnNames: any[], columnValues: any[]): number;
|
|
3257
|
+
/**
|
|
3258
|
+
* 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.
|
|
3259
|
+
*
|
|
3260
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
|
|
3261
|
+
*
|
|
3262
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3263
|
+
* @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`.
|
|
3264
|
+
* @returns Rows from the data extension matching the filter (or all rows when no filter is supplied).
|
|
3265
|
+
* @example
|
|
3266
|
+
* Platform.Load("core", "1.1.5");
|
|
3267
|
+
* var birthdayDE = DataExtension.Init("birthdayDE");
|
|
3268
|
+
* var data = birthdayDE.Rows.Retrieve();
|
|
3269
|
+
* var filter = { Property: "Age", SimpleOperator: "greaterThan", Value: 20 };
|
|
3270
|
+
* var moredata = birthdayDE.Rows.Retrieve(filter);
|
|
3271
|
+
*/
|
|
306
3272
|
function Retrieve(filter?: object): object[];
|
|
3273
|
+
/**
|
|
3274
|
+
* Updates the columns of rows where `whereFieldNames` equal `whereValues` (AND-joined). Throws if no row matches.
|
|
3275
|
+
*
|
|
3276
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
|
|
3277
|
+
*
|
|
3278
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3279
|
+
* @param rowData - Object whose keys are columns to update and values are the new values.
|
|
3280
|
+
* @param whereFieldNames - Array of column names to match against.
|
|
3281
|
+
* @param whereValues - Array of values to match (one per column, in order).
|
|
3282
|
+
* @returns Returns "OK" on success or throws on failure.
|
|
3283
|
+
* @example
|
|
3284
|
+
* Platform.Load("Core", "1");
|
|
3285
|
+
* var dataExt = DataExtension.Init("NTO Customer List");
|
|
3286
|
+
* var fieldsToUpdate = { StateProvince: "QC", PreferredActivity: "Sailing" };
|
|
3287
|
+
* var result = dataExt.Rows.Update(fieldsToUpdate, ["MemberId", "Country"], [9868600, "CA"]);
|
|
3288
|
+
*/
|
|
307
3289
|
function Update(rowData: object, whereFieldNames: any[], whereValues: any[]): string;
|
|
308
3290
|
}
|
|
309
3291
|
declare namespace DateTime.TimeZone {
|
|
3292
|
+
/**
|
|
3293
|
+
* Retrieves an array of time zones matching the specified filter criteria. If no filter is supplied the function returns all available time zones.
|
|
3294
|
+
*
|
|
3295
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/datetime-timezone/)
|
|
3296
|
+
*
|
|
3297
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3298
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3299
|
+
* @example
|
|
3300
|
+
* Platform.Load("core", "1.1.5");
|
|
3301
|
+
* var timezones = DateTime.TimeZone.Retrieve({ Property: "ID", SimpleOperator: "equals", Value: 1 });
|
|
3302
|
+
* Write(Stringify(timezones));
|
|
3303
|
+
*/
|
|
310
3304
|
function Retrieve(filter: object): object[];
|
|
311
3305
|
}
|
|
312
3306
|
|
|
313
3307
|
// ── Standalone Core Library globals ──────────────────────────────────────────
|
|
314
3308
|
declare namespace Attribute {
|
|
3309
|
+
/**
|
|
3310
|
+
* 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.
|
|
3311
|
+
*
|
|
3312
|
+
* [ssjs.guide reference](https://ssjs.guide/global-functions/attribute/)
|
|
3313
|
+
*
|
|
3314
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3315
|
+
* @param name - Name of the subscriber attribute or sendable DE field to retrieve.
|
|
3316
|
+
* @example
|
|
3317
|
+
* Platform.Load("core", "1.1.5");
|
|
3318
|
+
* var email = Attribute.GetValue("EmailAddress");
|
|
3319
|
+
* Write(email);
|
|
3320
|
+
*/
|
|
315
3321
|
function GetValue(name: string): string;
|
|
316
3322
|
}
|
|
317
3323
|
|
|
318
3324
|
declare namespace ErrorUtil {
|
|
3325
|
+
/**
|
|
3326
|
+
* 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.
|
|
3327
|
+
*
|
|
3328
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/errorutil/)
|
|
3329
|
+
*
|
|
3330
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3331
|
+
* @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.
|
|
3332
|
+
* @example
|
|
3333
|
+
* Platform.Load("core", "1.1.5");
|
|
3334
|
+
* var api = new Script.Util.WSProxy();
|
|
3335
|
+
* var customerKey = "0b744ffa-bab5-458d-9e7d-fb05a7873380";
|
|
3336
|
+
* try {
|
|
3337
|
+
* var result = api.retrieve(
|
|
3338
|
+
* "DataExtensionObject[" + customerKey + "]",
|
|
3339
|
+
* ["FirstName", "LastName", "EmailAddress"]
|
|
3340
|
+
* );
|
|
3341
|
+
* ErrorUtil.ThrowWSProxyError(result);
|
|
3342
|
+
* // process successful results
|
|
3343
|
+
* } catch (ex) {
|
|
3344
|
+
* // custom error-handling logic
|
|
3345
|
+
* }
|
|
3346
|
+
*/
|
|
319
3347
|
function ThrowWSProxyError(result: object): void;
|
|
320
3348
|
}
|
|
321
3349
|
|
|
322
3350
|
// ── Event namespaces ─────────────────────────────────────────────────────────
|
|
323
3351
|
declare namespace BounceEvent {
|
|
3352
|
+
/**
|
|
3353
|
+
* Retrieves bounce event data for message sends matching the specified filter.
|
|
3354
|
+
*
|
|
3355
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3356
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3357
|
+
* @example
|
|
3358
|
+
* Platform.Load("core", "1.1.5");
|
|
3359
|
+
* var bounces = BounceEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3360
|
+
* Write(Stringify(bounces));
|
|
3361
|
+
*/
|
|
324
3362
|
function Retrieve(filter: object): object[];
|
|
325
3363
|
}
|
|
326
3364
|
declare namespace ClickEvent {
|
|
3365
|
+
/**
|
|
3366
|
+
* Retrieves click tracking event data for message sends matching the specified filter.
|
|
3367
|
+
*
|
|
3368
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3369
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3370
|
+
* @example
|
|
3371
|
+
* Platform.Load("core", "1.1.5");
|
|
3372
|
+
* var clicks = ClickEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3373
|
+
* Write(Stringify(clicks));
|
|
3374
|
+
*/
|
|
327
3375
|
function Retrieve(filter: object): object[];
|
|
328
3376
|
}
|
|
329
3377
|
declare namespace ForwardedEmailEvent {
|
|
3378
|
+
/**
|
|
3379
|
+
* Retrieves forwarded email event data for message sends matching the specified filter.
|
|
3380
|
+
*
|
|
3381
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3382
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3383
|
+
* @example
|
|
3384
|
+
* Platform.Load("core", "1.1.5");
|
|
3385
|
+
* var forwards = ForwardedEmailEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3386
|
+
* Write(Stringify(forwards));
|
|
3387
|
+
*/
|
|
330
3388
|
function Retrieve(filter: object): object[];
|
|
331
3389
|
}
|
|
332
3390
|
declare namespace ForwardedEmailOptInEvent {
|
|
3391
|
+
/**
|
|
3392
|
+
* Retrieves forwarded email opt-in event data for message sends matching the specified filter.
|
|
3393
|
+
*
|
|
3394
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3395
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3396
|
+
* @example
|
|
3397
|
+
* Platform.Load("core", "1.1.5");
|
|
3398
|
+
* var optIns = ForwardedEmailOptInEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3399
|
+
* Write(Stringify(optIns));
|
|
3400
|
+
*/
|
|
333
3401
|
function Retrieve(filter: object): object[];
|
|
334
3402
|
}
|
|
335
3403
|
declare namespace NotSentEvent {
|
|
3404
|
+
/**
|
|
3405
|
+
* Retrieves not-sent event data for message sends matching the specified filter.
|
|
3406
|
+
*
|
|
3407
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3408
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3409
|
+
* @example
|
|
3410
|
+
* Platform.Load("core", "1.1.5");
|
|
3411
|
+
* var notSent = NotSentEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3412
|
+
* Write(Stringify(notSent));
|
|
3413
|
+
*/
|
|
336
3414
|
function Retrieve(filter: object): object[];
|
|
337
3415
|
}
|
|
338
3416
|
declare namespace OpenEvent {
|
|
3417
|
+
/**
|
|
3418
|
+
* Retrieves open tracking event data for message sends matching the specified filter.
|
|
3419
|
+
*
|
|
3420
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3421
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3422
|
+
* @example
|
|
3423
|
+
* Platform.Load("core", "1.1.5");
|
|
3424
|
+
* var opens = OpenEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3425
|
+
* Write(Stringify(opens));
|
|
3426
|
+
*/
|
|
339
3427
|
function Retrieve(filter: object): object[];
|
|
340
3428
|
}
|
|
341
3429
|
declare namespace SentEvent {
|
|
3430
|
+
/**
|
|
3431
|
+
* Retrieves sent event data for message sends matching the specified filter.
|
|
3432
|
+
*
|
|
3433
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3434
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3435
|
+
* @example
|
|
3436
|
+
* Platform.Load("core", "1.1.5");
|
|
3437
|
+
* var sent = SentEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3438
|
+
* Write(Stringify(sent));
|
|
3439
|
+
*/
|
|
342
3440
|
function Retrieve(filter: object): object[];
|
|
343
3441
|
}
|
|
344
3442
|
declare namespace SurveyEvent {
|
|
3443
|
+
/**
|
|
3444
|
+
* Retrieves survey response event data for message sends matching the specified filter.
|
|
3445
|
+
*
|
|
3446
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3447
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3448
|
+
* @example
|
|
3449
|
+
* Platform.Load("core", "1.1.5");
|
|
3450
|
+
* var surveys = SurveyEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3451
|
+
* Write(Stringify(surveys));
|
|
3452
|
+
*/
|
|
345
3453
|
function Retrieve(filter: object): object[];
|
|
346
3454
|
}
|
|
347
3455
|
declare namespace UnsubEvent {
|
|
3456
|
+
/**
|
|
3457
|
+
* Retrieves unsubscribe event data for message sends matching the specified filter.
|
|
3458
|
+
*
|
|
3459
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3460
|
+
* @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
|
|
3461
|
+
* @example
|
|
3462
|
+
* Platform.Load("core", "1.1.5");
|
|
3463
|
+
* var unsubs = UnsubEvent.Retrieve({ Property: "SendID", SimpleOperator: "equals", Value: 12345 });
|
|
3464
|
+
* Write(Stringify(unsubs));
|
|
3465
|
+
*/
|
|
348
3466
|
function Retrieve(filter: object): object[];
|
|
349
3467
|
}
|
|
350
3468
|
|
|
351
3469
|
// ── HTTP / HTTPHeader ────────────────────────────────────────────────────────
|
|
352
3470
|
declare namespace HTTP {
|
|
3471
|
+
/**
|
|
3472
|
+
* Performs an HTTP GET request and returns the response body. When supplying `headerNames` and `headerValues`, both arrays must have equal length and parallel ordering.
|
|
3473
|
+
*
|
|
3474
|
+
* [ssjs.guide reference](https://ssjs.guide/http/get/)
|
|
3475
|
+
*
|
|
3476
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3477
|
+
* @param url - URL to request.
|
|
3478
|
+
* @param headerNames - Array of header names (co-required with headerValues).
|
|
3479
|
+
* @param headerValues - Array of header values, one per entry in headerNames (co-required).
|
|
3480
|
+
* @example
|
|
3481
|
+
* Platform.Load("core", "1.1.5");
|
|
3482
|
+
* var body = HTTP.Get("https://api.example.com/data");
|
|
3483
|
+
* var obj = Platform.Function.ParseJSON(String(body));
|
|
3484
|
+
*/
|
|
353
3485
|
function Get(url: string, headerNames?: any[], headerValues?: any[]): object;
|
|
3486
|
+
/**
|
|
3487
|
+
* Performs an HTTP POST request with a content type and payload. Pass empty arrays for `headerNames` and `headerValues` if no custom headers are needed.
|
|
3488
|
+
*
|
|
3489
|
+
* [ssjs.guide reference](https://ssjs.guide/http/post/)
|
|
3490
|
+
*
|
|
3491
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3492
|
+
* @param url - URL to post to.
|
|
3493
|
+
* @param contentType - MIME type of the request body.
|
|
3494
|
+
* @param payload - Request body content.
|
|
3495
|
+
* @param headerNames - Array of header names to include in the request.
|
|
3496
|
+
* @param headerValues - Array of header values, one per entry in headerNames.
|
|
3497
|
+
* @example
|
|
3498
|
+
* Platform.Load("core", "1.1.5");
|
|
3499
|
+
* var payload = Stringify({ email: "jane@example.com" });
|
|
3500
|
+
* var response = HTTP.Post("https://api.example.com/items", "application/json", payload);
|
|
3501
|
+
*/
|
|
354
3502
|
function Post(url: string, contentType: string, payload: string, headerNames: string[], headerValues: any[]): object;
|
|
355
3503
|
}
|
|
356
3504
|
|
|
357
3505
|
declare namespace HTTPHeader {
|
|
3506
|
+
/**
|
|
3507
|
+
* Retrieves the value of the specified HTTP request header.
|
|
3508
|
+
*
|
|
3509
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/httpheader/)
|
|
3510
|
+
*
|
|
3511
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3512
|
+
* @param name - Name of the HTTP header to read
|
|
3513
|
+
* @example
|
|
3514
|
+
* Platform.Load("core", "1");
|
|
3515
|
+
* var from = HTTPHeader.GetValue("From");
|
|
3516
|
+
* Write(from);
|
|
3517
|
+
*/
|
|
358
3518
|
function GetValue(name: string): string;
|
|
3519
|
+
/**
|
|
3520
|
+
* Sets the value of the specified HTTP header. The host and content-length headers cannot be changed.
|
|
3521
|
+
*
|
|
3522
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/httpheader/)
|
|
3523
|
+
*
|
|
3524
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3525
|
+
* @param name - Name of the header to set
|
|
3526
|
+
* @param value - Value to assign to the header
|
|
3527
|
+
* @example
|
|
3528
|
+
* Platform.Load("core", "1");
|
|
3529
|
+
* HTTPHeader.SetValue("From", "aruiz@example.com");
|
|
3530
|
+
*/
|
|
359
3531
|
function SetValue(name: string, value: string): void;
|
|
3532
|
+
/**
|
|
3533
|
+
* Removes the specified entry from the HTTP header.
|
|
3534
|
+
*
|
|
3535
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/httpheader/)
|
|
3536
|
+
*
|
|
3537
|
+
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
3538
|
+
* @param headerName - Name of the header to remove
|
|
3539
|
+
* @example
|
|
3540
|
+
* Platform.Load("core", "1");
|
|
3541
|
+
* var result = HTTPHeader.Remove("From"); // returns "OK"
|
|
3542
|
+
*/
|
|
360
3543
|
function Remove(headerName: string): string;
|
|
361
3544
|
}
|
|
362
3545
|
|
|
@@ -365,34 +3548,368 @@ declare namespace Script {
|
|
|
365
3548
|
namespace Util {
|
|
366
3549
|
class WSProxy {
|
|
367
3550
|
constructor();
|
|
3551
|
+
/**
|
|
3552
|
+
* Creates a new Marketing Cloud object via the SOAP API.
|
|
3553
|
+
*
|
|
3554
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/createitem/)
|
|
3555
|
+
*
|
|
3556
|
+
* @param objectType - SOAP API object type name
|
|
3557
|
+
* @param properties - Object properties to set
|
|
3558
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3559
|
+
* @example
|
|
3560
|
+
* var api = new Script.Util.WSProxy();
|
|
3561
|
+
* var result = api.createItem("DataExtensionObject", {
|
|
3562
|
+
* CustomerKey: "MyDE",
|
|
3563
|
+
* Properties: { Property: [{ Name: "Email", Value: "jane@example.com" }] }
|
|
3564
|
+
* });
|
|
3565
|
+
* if (result.Status === "OK") { Write("Created"); }
|
|
3566
|
+
*/
|
|
368
3567
|
createItem(objectType: string, properties: object): object;
|
|
3568
|
+
/**
|
|
3569
|
+
* Updates an existing Marketing Cloud object via the SOAP API.
|
|
3570
|
+
*
|
|
3571
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/updateitem/)
|
|
3572
|
+
*
|
|
3573
|
+
* @param objectType - SOAP API object type name
|
|
3574
|
+
* @param properties - Object properties to update
|
|
3575
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3576
|
+
* @example
|
|
3577
|
+
* var api = new Script.Util.WSProxy();
|
|
3578
|
+
* var result = api.updateItem("DataExtensionObject", {
|
|
3579
|
+
* CustomerKey: "MyDE",
|
|
3580
|
+
* Properties: { Property: [{ Name: "Status", Value: "inactive" }] }
|
|
3581
|
+
* });
|
|
3582
|
+
* if (result.Status === "OK") { Write("Updated"); }
|
|
3583
|
+
*/
|
|
369
3584
|
updateItem(objectType: string, properties: object): object;
|
|
3585
|
+
/**
|
|
3586
|
+
* Deletes a Marketing Cloud object via the SOAP API.
|
|
3587
|
+
*
|
|
3588
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/deleteitem/)
|
|
3589
|
+
*
|
|
3590
|
+
* @param objectType - SOAP API object type name
|
|
3591
|
+
* @param properties - Object properties identifying the item to delete
|
|
3592
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3593
|
+
* @example
|
|
3594
|
+
* var api = new Script.Util.WSProxy();
|
|
3595
|
+
* var result = api.deleteItem("DataExtensionObject", {
|
|
3596
|
+
* CustomerKey: "MyDE",
|
|
3597
|
+
* Keys: { Key: [{ Name: "Email", Value: "jane@example.com" }] }
|
|
3598
|
+
* });
|
|
3599
|
+
* if (result.Status === "OK") { Write("Deleted"); }
|
|
3600
|
+
*/
|
|
370
3601
|
deleteItem(objectType: string, properties: object): object;
|
|
3602
|
+
/**
|
|
3603
|
+
* 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.
|
|
3604
|
+
*
|
|
3605
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/retrieve/)
|
|
3606
|
+
*
|
|
3607
|
+
* @param objectType - SOAP API object type name
|
|
3608
|
+
* @param columns - Array of property names to retrieve
|
|
3609
|
+
* @param filter - Simple or complex filter object
|
|
3610
|
+
* @param retrieveOptions - Properties to set on the SOAP RetrieveOptions object
|
|
3611
|
+
* @param requestProps - Additional request properties (e.g. QueryAllAccounts)
|
|
3612
|
+
* @returns Object with Status, HasMoreRows, RequestID, and Results array.
|
|
3613
|
+
* @example
|
|
3614
|
+
* var api = new Script.Util.WSProxy();
|
|
3615
|
+
* var cols = ["Name", "CustomerKey", "Status"];
|
|
3616
|
+
* var filter = {
|
|
3617
|
+
* Property: "Status",
|
|
3618
|
+
* SimpleOperator: "equals",
|
|
3619
|
+
* Value: "Active"
|
|
3620
|
+
* };
|
|
3621
|
+
* var result = api.retrieve("DataExtension", cols, filter);
|
|
3622
|
+
* if (result.Status === "OK") {
|
|
3623
|
+
* var rows = result.Results;
|
|
3624
|
+
* for (var i = 0; i < rows.length; i++) {
|
|
3625
|
+
* Write(rows[i].Name + "<br>");
|
|
3626
|
+
* }
|
|
3627
|
+
* }
|
|
3628
|
+
*/
|
|
371
3629
|
retrieve(objectType: string, columns: any[], filter?: object, retrieveOptions?: object, requestProps?: object): object;
|
|
3630
|
+
/**
|
|
3631
|
+
* Retrieves the next page of results from a previous retrieve call that returned HasMoreRows = true.
|
|
3632
|
+
*
|
|
3633
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/getnextbatch/)
|
|
3634
|
+
*
|
|
3635
|
+
* @param objectType - SOAP API object type name used in the original retrieve call
|
|
3636
|
+
* @param requestId - RequestID returned by the previous retrieve response
|
|
3637
|
+
* @returns Object with Status, HasMoreRows, RequestID, and Results array.
|
|
3638
|
+
* @example
|
|
3639
|
+
* var api = new Script.Util.WSProxy();
|
|
3640
|
+
* var result = api.retrieve("DataExtension", ["Name"], {});
|
|
3641
|
+
* while (result.HasMoreRows) {
|
|
3642
|
+
* result = api.getNextBatch("DataExtension", result.RequestID);
|
|
3643
|
+
* for (var i = 0; i < result.Results.length; i++) {
|
|
3644
|
+
* Write(result.Results[i].Name + "<br>");
|
|
3645
|
+
* }
|
|
3646
|
+
* }
|
|
3647
|
+
*/
|
|
372
3648
|
getNextBatch(objectType: string, requestId: string): object;
|
|
3649
|
+
/**
|
|
3650
|
+
* Executes a perform action on a single Marketing Cloud object.
|
|
3651
|
+
*
|
|
3652
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/perform/)
|
|
3653
|
+
*
|
|
3654
|
+
* @param objectType - SOAP API object type name.
|
|
3655
|
+
* @param properties - Object properties identifying the target item (e.g. { ObjectID: "..." }).
|
|
3656
|
+
* @param action - Action to perform. Only "Start" is valid (lowercase "start" fails).
|
|
3657
|
+
* @param performOptions - Properties of the SOAP PerformOptions object.
|
|
3658
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3659
|
+
* @example
|
|
3660
|
+
* var api = new Script.Util.WSProxy();
|
|
3661
|
+
* var result = api.performItem("QueryDefinition", { ObjectID: queryObjectId }, "Start");
|
|
3662
|
+
* Write(result.Status);
|
|
3663
|
+
*/
|
|
373
3664
|
performItem(objectType: string, properties: object, action: string, performOptions?: object): object;
|
|
3665
|
+
/**
|
|
3666
|
+
* Executes a perform action on multiple Marketing Cloud objects in a single SOAP API call.
|
|
3667
|
+
*
|
|
3668
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/performbatch/)
|
|
3669
|
+
*
|
|
3670
|
+
* @param objectType - SOAP API object type name
|
|
3671
|
+
* @param propertiesArray - Array of property objects identifying the target items
|
|
3672
|
+
* @param action - Action to perform. Only "Start" is valid (lowercase "start" fails).
|
|
3673
|
+
* @param performOptions - Properties of the SOAP PerformOptions object
|
|
3674
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3675
|
+
* @example
|
|
3676
|
+
* var api = new Script.Util.WSProxy();
|
|
3677
|
+
* var items = [{ ObjectID: id1 }, { ObjectID: id2 }];
|
|
3678
|
+
* var result = api.performBatch("QueryDefinition", items, "Start");
|
|
3679
|
+
* Write(result.Status);
|
|
3680
|
+
*/
|
|
374
3681
|
performBatch(objectType: string, propertiesArray: any[], action: string, performOptions?: object): object;
|
|
3682
|
+
/**
|
|
3683
|
+
* Returns structural metadata (ObjectDefinition) for one or more SOAP API object types.
|
|
3684
|
+
*
|
|
3685
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/describe/)
|
|
3686
|
+
*
|
|
3687
|
+
* @param objectType - Object type name or array of type names to describe
|
|
3688
|
+
* @returns Object with Status and Results array containing ObjectDefinition entries.
|
|
3689
|
+
* @example
|
|
3690
|
+
* var api = new Script.Util.WSProxy();
|
|
3691
|
+
* var result = api.describe("DataExtension");
|
|
3692
|
+
* Write(Stringify(result.Results));
|
|
3693
|
+
*/
|
|
375
3694
|
describe(objectType: string): object;
|
|
3695
|
+
/**
|
|
3696
|
+
* Executes a named method on a Marketing Cloud object.
|
|
3697
|
+
*
|
|
3698
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/execute/)
|
|
3699
|
+
*
|
|
3700
|
+
* @param objectType - SOAP API object type name.
|
|
3701
|
+
* @param requestName - Name of the request to execute.
|
|
3702
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3703
|
+
* @example
|
|
3704
|
+
* var api = new Script.Util.WSProxy();
|
|
3705
|
+
* var result = api.execute("DataExtensionObject", "LogUnsubEvent");
|
|
3706
|
+
* Write(result.Status);
|
|
3707
|
+
*/
|
|
376
3708
|
execute(objectType: string, requestName: string): object;
|
|
3709
|
+
/**
|
|
3710
|
+
* Sets the maximum number of objects returned per SOAP API page (default is 2500).
|
|
3711
|
+
*
|
|
3712
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/setbatchsize/)
|
|
3713
|
+
*
|
|
3714
|
+
* @param batchSize - Maximum number of objects per batch
|
|
3715
|
+
* @example
|
|
3716
|
+
* var api = new Script.Util.WSProxy();
|
|
3717
|
+
* api.setBatchSize(200);
|
|
3718
|
+
* var result = api.retrieve("DataExtension", ["Name"], {});
|
|
3719
|
+
*/
|
|
377
3720
|
setBatchSize(batchSize: number): void;
|
|
3721
|
+
/**
|
|
3722
|
+
* Sets the business unit MID for cross-account operations.
|
|
3723
|
+
*
|
|
3724
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/setclientid/)
|
|
3725
|
+
*
|
|
3726
|
+
* @param clientId - Object containing the MID of the target business unit
|
|
3727
|
+
* @example
|
|
3728
|
+
* var api = new Script.Util.WSProxy();
|
|
3729
|
+
* api.setClientId({ ID: 12345 }); // target child BU by MID
|
|
3730
|
+
* var result = api.retrieve("DataExtension", ["Name"], {});
|
|
3731
|
+
*/
|
|
378
3732
|
setClientId(clientId: object): void;
|
|
3733
|
+
/**
|
|
3734
|
+
* Clears all client IDs set on the WSProxy instance, reverting to the default execution context credentials.
|
|
3735
|
+
*
|
|
3736
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/resetclientids/)
|
|
3737
|
+
*
|
|
3738
|
+
* @example
|
|
3739
|
+
* var api = new Script.Util.WSProxy();
|
|
3740
|
+
* api.setClientId({ ID: 12345 });
|
|
3741
|
+
* // ... perform cross-BU operations ...
|
|
3742
|
+
* api.resetClientIds(); // revert to default context
|
|
3743
|
+
* var result = api.retrieve("DataExtension", ["Name"], {});
|
|
3744
|
+
*/
|
|
379
3745
|
resetClientIds(): void;
|
|
3746
|
+
/**
|
|
3747
|
+
* Creates multiple Marketing Cloud objects in a single SOAP API call.
|
|
3748
|
+
*
|
|
3749
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/createbatch/)
|
|
3750
|
+
*
|
|
3751
|
+
* @param objectType - SOAP API object type name
|
|
3752
|
+
* @param propertiesArray - Array of property objects to create
|
|
3753
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3754
|
+
* @example
|
|
3755
|
+
* var api = new Script.Util.WSProxy();
|
|
3756
|
+
* var items = [
|
|
3757
|
+
* { CustomerKey: "MyDE", Properties: { Property: [{ Name: "Email", Value: "a@example.com" }] } },
|
|
3758
|
+
* { CustomerKey: "MyDE", Properties: { Property: [{ Name: "Email", Value: "b@example.com" }] } }
|
|
3759
|
+
* ];
|
|
3760
|
+
* var result = api.createBatch("DataExtensionObject", items);
|
|
3761
|
+
* Write(result.Status);
|
|
3762
|
+
*/
|
|
380
3763
|
createBatch(objectType: string, propertiesArray: any[]): object;
|
|
3764
|
+
/**
|
|
3765
|
+
* Updates multiple Marketing Cloud objects in a single SOAP API call.
|
|
3766
|
+
*
|
|
3767
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/updatebatch/)
|
|
3768
|
+
*
|
|
3769
|
+
* @param objectType - SOAP API object type name
|
|
3770
|
+
* @param propertiesArray - Array of property objects to update
|
|
3771
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3772
|
+
* @example
|
|
3773
|
+
* var api = new Script.Util.WSProxy();
|
|
3774
|
+
* var items = [
|
|
3775
|
+
* { CustomerKey: "MyDE", Keys: { Key: [{ Name: "Email", Value: "a@example.com" }] }, Properties: { Property: [{ Name: "Status", Value: "active" }] } }
|
|
3776
|
+
* ];
|
|
3777
|
+
* var result = api.updateBatch("DataExtensionObject", items);
|
|
3778
|
+
* Write(result.Status);
|
|
3779
|
+
*/
|
|
381
3780
|
updateBatch(objectType: string, propertiesArray: any[]): object;
|
|
3781
|
+
/**
|
|
3782
|
+
* Deletes multiple Marketing Cloud objects in a single SOAP API call.
|
|
3783
|
+
*
|
|
3784
|
+
* [ssjs.guide reference](https://ssjs.guide/wsproxy/deletebatch/)
|
|
3785
|
+
*
|
|
3786
|
+
* @param objectType - SOAP API object type name
|
|
3787
|
+
* @param propertiesArray - Array of property objects to delete
|
|
3788
|
+
* @returns Object with Status, StatusMessage, RequestID, and Results array.
|
|
3789
|
+
* @example
|
|
3790
|
+
* var api = new Script.Util.WSProxy();
|
|
3791
|
+
* var items = [
|
|
3792
|
+
* { CustomerKey: "MyDE", Keys: { Key: [{ Name: "Email", Value: "old@example.com" }] } }
|
|
3793
|
+
* ];
|
|
3794
|
+
* var result = api.deleteBatch("DataExtensionObject", items);
|
|
3795
|
+
* Write(result.Status);
|
|
3796
|
+
*/
|
|
382
3797
|
deleteBatch(objectType: string, propertiesArray: any[]): object;
|
|
383
3798
|
}
|
|
384
3799
|
class HttpRequest {
|
|
385
3800
|
constructor(url: string);
|
|
3801
|
+
/**
|
|
3802
|
+
* 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().
|
|
3803
|
+
*
|
|
3804
|
+
* [ssjs.guide reference](https://ssjs.guide/http/request-methods/)
|
|
3805
|
+
*
|
|
3806
|
+
* @example
|
|
3807
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
3808
|
+
* req.method = "GET";
|
|
3809
|
+
* req.setHeader("Authorization", "Bearer " + accessToken);
|
|
3810
|
+
* var resp = req.send();
|
|
3811
|
+
* if (resp.statusCode == 200) {
|
|
3812
|
+
* var result = Platform.Function.ParseJSON(String(resp.content));
|
|
3813
|
+
* }
|
|
3814
|
+
*/
|
|
386
3815
|
send(): object;
|
|
3816
|
+
/**
|
|
3817
|
+
* Sets a request header on the Script.Util HTTP request. Note: setting a custom header disables content caching for Script.Util.HttpGet.
|
|
3818
|
+
*
|
|
3819
|
+
* [ssjs.guide reference](https://ssjs.guide/http/request-methods/)
|
|
3820
|
+
*
|
|
3821
|
+
* @param name - Header name (e.g. "Authorization", "Content-Type")
|
|
3822
|
+
* @param value - Header value
|
|
3823
|
+
* @example
|
|
3824
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
3825
|
+
* req.setHeader("Authorization", "Bearer " + accessToken);
|
|
3826
|
+
* req.setHeader("Content-Type", "application/json");
|
|
3827
|
+
* var resp = req.send();
|
|
3828
|
+
*/
|
|
387
3829
|
setHeader(name: string, value: string): void;
|
|
3830
|
+
/**
|
|
3831
|
+
* Removes all custom headers previously set on the request.
|
|
3832
|
+
*
|
|
3833
|
+
* [ssjs.guide reference](https://ssjs.guide/http/request-methods/)
|
|
3834
|
+
*
|
|
3835
|
+
* @example
|
|
3836
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
3837
|
+
* req.setHeader("Authorization", "Bearer " + accessToken);
|
|
3838
|
+
* req.clearHeaders(); // removes Authorization and all other custom headers
|
|
3839
|
+
* var resp = req.send();
|
|
3840
|
+
*/
|
|
388
3841
|
clearHeaders(): void;
|
|
3842
|
+
/**
|
|
3843
|
+
* Removes a specific header from the request by name.
|
|
3844
|
+
*
|
|
3845
|
+
* [ssjs.guide reference](https://ssjs.guide/http/request-methods/)
|
|
3846
|
+
*
|
|
3847
|
+
* @param name - Name of the header to remove
|
|
3848
|
+
* @example
|
|
3849
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
3850
|
+
* req.setHeader("Authorization", "Bearer " + accessToken);
|
|
3851
|
+
* req.setHeader("X-Custom", "value");
|
|
3852
|
+
* req.removeHeader("X-Custom");
|
|
3853
|
+
* var resp = req.send();
|
|
3854
|
+
*/
|
|
389
3855
|
removeHeader(name: string): void;
|
|
390
3856
|
}
|
|
391
3857
|
class HttpGet {
|
|
392
3858
|
constructor(url: string);
|
|
3859
|
+
/**
|
|
3860
|
+
* 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().
|
|
3861
|
+
*
|
|
3862
|
+
* [ssjs.guide reference](https://ssjs.guide/http/request-methods/)
|
|
3863
|
+
*
|
|
3864
|
+
* @example
|
|
3865
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
3866
|
+
* req.method = "GET";
|
|
3867
|
+
* req.setHeader("Authorization", "Bearer " + accessToken);
|
|
3868
|
+
* var resp = req.send();
|
|
3869
|
+
* if (resp.statusCode == 200) {
|
|
3870
|
+
* var result = Platform.Function.ParseJSON(String(resp.content));
|
|
3871
|
+
* }
|
|
3872
|
+
*/
|
|
393
3873
|
send(): object;
|
|
3874
|
+
/**
|
|
3875
|
+
* Sets a request header on the Script.Util HTTP request. Note: setting a custom header disables content caching for Script.Util.HttpGet.
|
|
3876
|
+
*
|
|
3877
|
+
* [ssjs.guide reference](https://ssjs.guide/http/request-methods/)
|
|
3878
|
+
*
|
|
3879
|
+
* @param name - Header name (e.g. "Authorization", "Content-Type")
|
|
3880
|
+
* @param value - Header value
|
|
3881
|
+
* @example
|
|
3882
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
3883
|
+
* req.setHeader("Authorization", "Bearer " + accessToken);
|
|
3884
|
+
* req.setHeader("Content-Type", "application/json");
|
|
3885
|
+
* var resp = req.send();
|
|
3886
|
+
*/
|
|
394
3887
|
setHeader(name: string, value: string): void;
|
|
3888
|
+
/**
|
|
3889
|
+
* Removes all custom headers previously set on the request.
|
|
3890
|
+
*
|
|
3891
|
+
* [ssjs.guide reference](https://ssjs.guide/http/request-methods/)
|
|
3892
|
+
*
|
|
3893
|
+
* @example
|
|
3894
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
3895
|
+
* req.setHeader("Authorization", "Bearer " + accessToken);
|
|
3896
|
+
* req.clearHeaders(); // removes Authorization and all other custom headers
|
|
3897
|
+
* var resp = req.send();
|
|
3898
|
+
*/
|
|
395
3899
|
clearHeaders(): void;
|
|
3900
|
+
/**
|
|
3901
|
+
* Removes a specific header from the request by name.
|
|
3902
|
+
*
|
|
3903
|
+
* [ssjs.guide reference](https://ssjs.guide/http/request-methods/)
|
|
3904
|
+
*
|
|
3905
|
+
* @param name - Name of the header to remove
|
|
3906
|
+
* @example
|
|
3907
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
3908
|
+
* req.setHeader("Authorization", "Bearer " + accessToken);
|
|
3909
|
+
* req.setHeader("X-Custom", "value");
|
|
3910
|
+
* req.removeHeader("X-Custom");
|
|
3911
|
+
* var resp = req.send();
|
|
3912
|
+
*/
|
|
396
3913
|
removeHeader(name: string): void;
|
|
397
3914
|
}
|
|
398
3915
|
}
|
|
@@ -432,12 +3949,45 @@ interface String {
|
|
|
432
3949
|
}
|
|
433
3950
|
|
|
434
3951
|
interface Number {
|
|
3952
|
+
/**
|
|
3953
|
+
* Returns a string representing the number in fixed-point notation with the given number of decimal places.
|
|
3954
|
+
*
|
|
3955
|
+
* @param fractionDigits - Number of digits after the decimal point (0–20, default 0)
|
|
3956
|
+
* @example
|
|
3957
|
+
* var price = 9.99;
|
|
3958
|
+
* Write(price.toFixed(2)); // "9.99"
|
|
3959
|
+
* Write((1.5).toFixed(0)); // "2"
|
|
3960
|
+
*/
|
|
435
3961
|
toFixed(fractionDigits?: number): string;
|
|
3962
|
+
/**
|
|
3963
|
+
* Returns a string representing the number in exponential notation. If fractionDigits is omitted, enough digits are included to uniquely identify the value.
|
|
3964
|
+
*
|
|
3965
|
+
* @param fractionDigits - Digits after the decimal point in the significand (0–20)
|
|
3966
|
+
* @example
|
|
3967
|
+
* Write((123456).toExponential(2)); // "1.23e+5"
|
|
3968
|
+
*/
|
|
436
3969
|
toExponential(fractionDigits?: number): string;
|
|
3970
|
+
/**
|
|
3971
|
+
* Returns a string representing the number to the specified number of significant digits.
|
|
3972
|
+
*
|
|
3973
|
+
* @param precision - Number of significant digits (1–21)
|
|
3974
|
+
* @example
|
|
3975
|
+
* Write((123.456).toPrecision(5)); // "123.46"
|
|
3976
|
+
*/
|
|
437
3977
|
toPrecision(precision?: number): string;
|
|
438
3978
|
}
|
|
439
3979
|
|
|
440
3980
|
interface Object {
|
|
3981
|
+
/**
|
|
3982
|
+
* Returns true if the object has the specified property as its own (not inherited) property. Commonly used to safely iterate for...in loops.
|
|
3983
|
+
*
|
|
3984
|
+
* @param v - Property name to test
|
|
3985
|
+
* @example
|
|
3986
|
+
* var obj = {a: 1};
|
|
3987
|
+
* for (var key in obj) {
|
|
3988
|
+
* if (obj.hasOwnProperty(key)) { Write(key); }
|
|
3989
|
+
* }
|
|
3990
|
+
*/
|
|
441
3991
|
hasOwnProperty(v?: string): boolean;
|
|
442
3992
|
}
|
|
443
3993
|
|