ssjs-data 0.3.2 → 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 +3101 -36
- 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,85 +5,912 @@
|
|
|
5
5
|
|
|
6
6
|
// ── Platform ────────────────────────────────────────────────────────────────
|
|
7
7
|
declare namespace Platform {
|
|
8
|
+
/**
|
|
9
|
+
* Loads a platform library. Must be called before using Core library objects.
|
|
10
|
+
*
|
|
11
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-load/)
|
|
12
|
+
*
|
|
13
|
+
* @param libraryName - Library to load (e.g. "core")
|
|
14
|
+
* @param version - Library version (e.g. "1.1.5")
|
|
15
|
+
* @example
|
|
16
|
+
* Platform.Load("core", "1.1.5");
|
|
17
|
+
* var de = DataExtension.Init("MyDE");
|
|
18
|
+
* var rows = de.Rows.Retrieve();
|
|
19
|
+
*/
|
|
8
20
|
function Load(libraryName: string, version: string): void;
|
|
9
21
|
namespace Function {
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves a single field value from a Data Extension row matching filter criteria. To filter by multiple columns, pass string arrays for whereFieldNames and whereFieldValues (AND logic).
|
|
24
|
+
*
|
|
25
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/lookup/)
|
|
26
|
+
*
|
|
27
|
+
* @param deName - Data Extension name or external key
|
|
28
|
+
* @param returnField - Name of the field to return
|
|
29
|
+
* @param whereFieldNames - Filter field name, or an array of field names connected with AND logic
|
|
30
|
+
* @param whereFieldValues - Filter field value matching whereFieldNames; must be an array of equal length when whereFieldNames is an array
|
|
31
|
+
* @example
|
|
32
|
+
* // Single filter:
|
|
33
|
+
* var email = Platform.Function.Lookup("Subscribers", "EmailAddress", "SubscriberKey", "abc123");
|
|
34
|
+
*
|
|
35
|
+
* // Multiple filters (AND logic):
|
|
36
|
+
* var phone = Platform.Function.Lookup("CustomerData", "Phone", ["FirstName", "LastName"], ["Carolyn", "Baumgartner"]);
|
|
37
|
+
*/
|
|
10
38
|
function Lookup(deName: string, returnField: string, whereFieldNames: string | string[], whereFieldValues: string | any[]): string;
|
|
39
|
+
/**
|
|
40
|
+
* Returns a result set of rows from a Data Extension matching filter criteria. Returns up to 2,000 rows. To filter by multiple columns, pass string arrays for whereFieldNames and whereFieldValues (AND logic).
|
|
41
|
+
*
|
|
42
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/lookuprows/)
|
|
43
|
+
*
|
|
44
|
+
* @param deName - Data Extension name or external key
|
|
45
|
+
* @param whereFieldNames - Filter field name, or an array of field names connected with AND logic
|
|
46
|
+
* @param whereFieldValues - Filter field value matching whereFieldNames; must be an array of equal length when whereFieldNames is an array
|
|
47
|
+
* @example
|
|
48
|
+
* // Single filter:
|
|
49
|
+
* var rows = Platform.Function.LookupRows("MyDE", "Status", "active");
|
|
50
|
+
* for (var i = 0; i < rows.length; i++) {
|
|
51
|
+
* Write(rows[i]["Name"] + "<br>");
|
|
52
|
+
* }
|
|
53
|
+
*
|
|
54
|
+
* // Multiple filters (AND logic):
|
|
55
|
+
* var rows2 = Platform.Function.LookupRows("CustomerData", ["PreferredLanguage", "RewardsTier"], ["English", "Gold"]);
|
|
56
|
+
*/
|
|
11
57
|
function LookupRows(deName: string, whereFieldNames: string | string[], whereFieldValues: string | any[]): object;
|
|
58
|
+
/**
|
|
59
|
+
* Returns an ordered result set from a Data Extension. The sort expression is a single string in the format "ColumnName ASC" or "ColumnName DESC". Multiple columns can be separated by commas. Returns up to 2,000 rows; values below 1 for count default to 2,000. To filter by multiple columns, pass string arrays for whereFieldNames and whereFieldValues (AND logic).
|
|
60
|
+
*
|
|
61
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/lookuporderedrows/)
|
|
62
|
+
*
|
|
63
|
+
* @param deName - Data Extension name or external key
|
|
64
|
+
* @param count - Maximum number of rows to return; values below 1 return up to 2,000
|
|
65
|
+
* @param orderBy - Sort expression using "ColumnName ASC/DESC" syntax (e.g. "LastName ASC, FirstName ASC")
|
|
66
|
+
* @param whereFieldNames - Filter field name, or an array of field names connected with AND logic
|
|
67
|
+
* @param whereFieldValues - Filter field value matching whereFieldNames; must be an array of equal length when whereFieldNames is an array
|
|
68
|
+
* @example
|
|
69
|
+
* // Single filter, sorted by LastName ASC:
|
|
70
|
+
* var rows = Platform.Function.LookupOrderedRows("MyDE", 10, "LastName ASC", "RewardsTier", "Silver");
|
|
71
|
+
* for (var i = 0; i < rows.length; i++) {
|
|
72
|
+
* Write(rows[i]["Email"] + "<br>");
|
|
73
|
+
* }
|
|
74
|
+
*
|
|
75
|
+
* // Multiple filters (AND logic):
|
|
76
|
+
* var rows2 = Platform.Function.LookupOrderedRows("CustomerData", 0, "LastName ASC", ["PreferredLanguage", "RewardsTier"], ["English", "Silver"]);
|
|
77
|
+
*/
|
|
12
78
|
function LookupOrderedRows(deName: string, count: number, orderBy: string, whereFieldNames: string | string[], whereFieldValues: string | any[]): object;
|
|
79
|
+
/**
|
|
80
|
+
* Adds a new row to a Data Extension. Use this function in CloudPages, landing pages, microsites, and SMS messages. Use InsertDE() for email contexts.
|
|
81
|
+
*
|
|
82
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/insertdata/)
|
|
83
|
+
*
|
|
84
|
+
* @param deName - Data Extension name or external key
|
|
85
|
+
* @param fieldNames - Array of column names to populate
|
|
86
|
+
* @param fieldValues - Array of values aligned to fieldNames
|
|
87
|
+
* @example
|
|
88
|
+
* var rowsAffected = Platform.Function.InsertData("MyDE", ["Email", "Name"], ["jane@example.com", "Jane"]);
|
|
89
|
+
*/
|
|
13
90
|
function InsertData(deName: string, fieldNames: string[], fieldValues: any[]): number;
|
|
91
|
+
/**
|
|
92
|
+
* Adds a new row to a Data Extension. Use this function in email contexts. Use InsertData() for CloudPages, landing pages, microsites, and SMS messages.
|
|
93
|
+
*
|
|
94
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/insertde/)
|
|
95
|
+
*
|
|
96
|
+
* @param deName - Data Extension name or external key
|
|
97
|
+
* @param fieldNames - Array of column names to populate
|
|
98
|
+
* @param fieldValues - Array of values aligned to fieldNames
|
|
99
|
+
* @example
|
|
100
|
+
* Platform.Function.InsertDE("MyDE", ["Email", "Name"], ["jane@example.com", "Jane"]);
|
|
101
|
+
*/
|
|
14
102
|
function InsertDE(deName: string, fieldNames: string[], fieldValues: any[]): void;
|
|
103
|
+
/**
|
|
104
|
+
* Modifies existing rows in a Data Extension matching filter criteria. Use this function in CloudPages, landing pages, microsites, and SMS messages. Use UpdateDE() for email contexts.
|
|
105
|
+
*
|
|
106
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/updatedata/)
|
|
107
|
+
*
|
|
108
|
+
* @param deName - Data Extension name or external key
|
|
109
|
+
* @param whereFieldNames - Column name(s) to identify the rows to update; use an array for multiple columns (AND logic)
|
|
110
|
+
* @param whereFieldValues - Value(s) to match in whereFieldNames; must be an array of equal length when whereFieldNames is an array
|
|
111
|
+
* @param fieldNames - Array of column names to update
|
|
112
|
+
* @param fieldValues - Array of new values aligned to fieldNames
|
|
113
|
+
* @example
|
|
114
|
+
* var count = Platform.Function.UpdateData("MyDE", ["Email"], ["jane@example.com"], ["Status"], ["inactive"]);
|
|
115
|
+
*/
|
|
15
116
|
function UpdateData(deName: string, whereFieldNames: string | string[], whereFieldValues: string | any[], fieldNames: string[], fieldValues: any[]): number;
|
|
117
|
+
/**
|
|
118
|
+
* Modifies existing rows in a Data Extension matching filter criteria. Use this function in email contexts. Use UpdateData() for CloudPages, landing pages, microsites, and SMS messages.
|
|
119
|
+
*
|
|
120
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/updatede/)
|
|
121
|
+
*
|
|
122
|
+
* @param deName - Data Extension name or external key
|
|
123
|
+
* @param whereFieldNames - Column name(s) to identify the rows to update; use an array for multiple columns (AND logic)
|
|
124
|
+
* @param whereFieldValues - Value(s) to match in whereFieldNames; must be an array of equal length when whereFieldNames is an array
|
|
125
|
+
* @param fieldNames - Array of column names to update
|
|
126
|
+
* @param fieldValues - Array of new values aligned to fieldNames
|
|
127
|
+
* @example
|
|
128
|
+
* var count = Platform.Function.UpdateDE("MyDE", ["Email"], ["jane@example.com"], ["Status"], ["inactive"]);
|
|
129
|
+
*/
|
|
16
130
|
function UpdateDE(deName: string, whereFieldNames: string | string[], whereFieldValues: string | any[], fieldNames: string[], fieldValues: any[]): number;
|
|
131
|
+
/**
|
|
132
|
+
* Inserts a new row or updates an existing one in a Data Extension. Use this function in non-sendable contexts such as CloudPages and landing pages.
|
|
133
|
+
*
|
|
134
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/upsertdata/)
|
|
135
|
+
*
|
|
136
|
+
* @param deName - Data Extension name or external key
|
|
137
|
+
* @param whereFieldNames - Column name(s) to identify an existing row; use an array for multiple columns (AND logic)
|
|
138
|
+
* @param whereFieldValues - Value(s) to match in whereFieldNames; must be an array of equal length when whereFieldNames is an array
|
|
139
|
+
* @param fieldNames - Array of column names to insert or update
|
|
140
|
+
* @param fieldValues - Array of values aligned to fieldNames
|
|
141
|
+
* @example
|
|
142
|
+
* var count = Platform.Function.UpsertData("CustomerData", ["ID"], ["12345"], ["Company", "Country"], ["exampleCompany", "USA"]);
|
|
143
|
+
*/
|
|
17
144
|
function UpsertData(deName: string, whereFieldNames: string | string[], whereFieldValues: string | any[], fieldNames: string[], fieldValues: any[]): number;
|
|
145
|
+
/**
|
|
146
|
+
* Inserts a new row or updates an existing one in a Data Extension. Use this function in sendable contexts such as email messages.
|
|
147
|
+
*
|
|
148
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/upsertde/)
|
|
149
|
+
*
|
|
150
|
+
* @param deName - Data Extension name or external key
|
|
151
|
+
* @param whereFieldNames - Column name(s) to identify an existing row; use an array for multiple columns (AND logic)
|
|
152
|
+
* @param whereFieldValues - Value(s) to match in whereFieldNames; must be an array of equal length when whereFieldNames is an array
|
|
153
|
+
* @param fieldNames - Array of column names to insert or update
|
|
154
|
+
* @param fieldValues - Array of values aligned to fieldNames
|
|
155
|
+
* @example
|
|
156
|
+
* var count = Platform.Function.UpsertDE("CustomerData", ["ID"], ["12345"], ["Company", "Country"], ["exampleCompany", "USA"]);
|
|
157
|
+
*/
|
|
18
158
|
function UpsertDE(deName: string, whereFieldNames: string | string[], whereFieldValues: string | any[], fieldNames: string[], fieldValues: any[]): number;
|
|
159
|
+
/**
|
|
160
|
+
* Removes rows from a Data Extension matching filter criteria. Use this function in non-sendable contexts such as CloudPages and landing pages. Use DeleteDE() for email contexts.
|
|
161
|
+
*
|
|
162
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/deletedata/)
|
|
163
|
+
*
|
|
164
|
+
* @param deName - Data Extension name or external key
|
|
165
|
+
* @param whereFieldNames - Array of column names to match for deletion
|
|
166
|
+
* @param whereFieldValues - Array of values aligned to whereFieldNames that identify rows to delete
|
|
167
|
+
* @example
|
|
168
|
+
* var count = Platform.Function.DeleteData("MyDE", ["Email"], ["jane@example.com"]);
|
|
169
|
+
*/
|
|
19
170
|
function DeleteData(deName: string, whereFieldNames: string[], whereFieldValues: any[]): number;
|
|
171
|
+
/**
|
|
172
|
+
* Removes rows from a Data Extension matching filter criteria. Use this function in email contexts. Use DeleteData() for CloudPages, landing pages, microsites, and SMS messages.
|
|
173
|
+
*
|
|
174
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/deletede/)
|
|
175
|
+
*
|
|
176
|
+
* @param deName - Data Extension name or external key
|
|
177
|
+
* @param whereFieldNames - Array of column names to match for deletion
|
|
178
|
+
* @param whereFieldValues - Array of values aligned to whereFieldNames that identify rows to delete
|
|
179
|
+
* @example
|
|
180
|
+
* var count = Platform.Function.DeleteDE("MyDE", ["Email"], ["jane@example.com"]);
|
|
181
|
+
*/
|
|
20
182
|
function DeleteDE(deName: string, whereFieldNames: string[], whereFieldValues: any[]): number;
|
|
183
|
+
/**
|
|
184
|
+
* Renders a Content Builder asset referenced by customer key.
|
|
185
|
+
*
|
|
186
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentblockbykey/)
|
|
187
|
+
*
|
|
188
|
+
* @param customerKey - Customer key of the Content Builder asset
|
|
189
|
+
* @param regionName - Impression region name for tracking
|
|
190
|
+
* @param stopOnError - When true, returns an exception and terminates if content cannot be retrieved. When false, the call proceeds.
|
|
191
|
+
* @param fallbackContent - Default content to display if the call does not return content
|
|
192
|
+
* @example
|
|
193
|
+
* var html = Platform.Function.ContentBlockByKey("my-header-block");
|
|
194
|
+
* Write(html);
|
|
195
|
+
*
|
|
196
|
+
* // With optional params:
|
|
197
|
+
* var html2 = Platform.Function.ContentBlockByKey("my-header-block", "impressionRegion", false, "defaultContent");
|
|
198
|
+
*/
|
|
21
199
|
function ContentBlockByKey(customerKey: string, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
|
|
200
|
+
/**
|
|
201
|
+
* Renders a Content Builder asset referenced by folder path and name. If the same name is used across multiple folders, supply the full path.
|
|
202
|
+
*
|
|
203
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentblockbyname/)
|
|
204
|
+
*
|
|
205
|
+
* @param name - Folder path and name of the Content Builder asset
|
|
206
|
+
* @param regionName - Impression region name for tracking
|
|
207
|
+
* @param stopOnError - When true, returns an error if the content area cannot be found or is invalid. When false, no error is returned.
|
|
208
|
+
* @param fallbackContent - Default content to return if an error occurs. Defaults to empty string.
|
|
209
|
+
* @param statusVariable - Receives the status of the call: 0 = success, -1 = no content or invalid content area
|
|
210
|
+
* @example
|
|
211
|
+
* var html = Platform.Function.ContentBlockByName("Shared Content/Footer");
|
|
212
|
+
* Write(html);
|
|
213
|
+
*/
|
|
22
214
|
function ContentBlockByName(name: string, regionName?: string, stopOnError?: boolean, fallbackContent?: string, statusVariable?: number): string;
|
|
215
|
+
/**
|
|
216
|
+
* Renders a Content Builder asset by its numeric identifier.
|
|
217
|
+
*
|
|
218
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentblockbyid/)
|
|
219
|
+
*
|
|
220
|
+
* @param id - Numeric ID of the Content Builder asset
|
|
221
|
+
* @param regionName - Impression region name for tracking
|
|
222
|
+
* @param stopOnError - When true, returns an exception and terminates if content cannot be retrieved. When false, the call proceeds.
|
|
223
|
+
* @param fallbackContent - Default content to display if the call does not return content
|
|
224
|
+
* @example
|
|
225
|
+
* var html = Platform.Function.ContentBlockByID(12345);
|
|
226
|
+
* Write(html);
|
|
227
|
+
*
|
|
228
|
+
* // With optional params:
|
|
229
|
+
* var html2 = Platform.Function.ContentBlockByID(12345, "impressionRegion", false, "defaultContent");
|
|
230
|
+
*/
|
|
23
231
|
function ContentBlockByID(id: number, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
|
|
232
|
+
/**
|
|
233
|
+
* Returns an HTML img tag for a Content Builder image identified by its external key. An optional fallback image ID can be supplied if the primary image is not found.
|
|
234
|
+
*
|
|
235
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentimagebykey/)
|
|
236
|
+
*
|
|
237
|
+
* @param key - External key of the Content Builder image
|
|
238
|
+
* @param fallbackId - Numeric ID of a fallback image when the primary cannot be found
|
|
239
|
+
* @example
|
|
240
|
+
* var imgTag = Platform.Function.ContentImageByKey("hero-banner-key");
|
|
241
|
+
* Write(imgTag);
|
|
242
|
+
*/
|
|
24
243
|
function ContentImageByKey(key: string, fallbackId?: number): string;
|
|
244
|
+
/**
|
|
245
|
+
* Returns an HTML img tag for a Content Builder image identified by its numeric ID. An optional fallback ID can be supplied if the primary image is not found.
|
|
246
|
+
*
|
|
247
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentimagebyid/)
|
|
248
|
+
*
|
|
249
|
+
* @param id - Numeric ID of the Content Builder image
|
|
250
|
+
* @param fallbackId - Numeric ID of a fallback image when the primary cannot be found
|
|
251
|
+
* @example
|
|
252
|
+
* var imgTag = Platform.Function.ContentImageByID(98765);
|
|
253
|
+
* Write(imgTag);
|
|
254
|
+
*/
|
|
25
255
|
function ContentImageByID(id: number, fallbackId?: number): string;
|
|
256
|
+
/**
|
|
257
|
+
* Processes a string as AMPscript/HTML and returns rendered output.
|
|
258
|
+
*
|
|
259
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/treatascontent/)
|
|
260
|
+
*
|
|
261
|
+
* @param content - String containing AMPscript or HTML to evaluate
|
|
262
|
+
* @example
|
|
263
|
+
* var result = Platform.Function.TreatAsContent("%%[Set @x = 1]%%%%=v(@x)=%%");
|
|
264
|
+
* Write(result); // "1"
|
|
265
|
+
*/
|
|
26
266
|
function TreatAsContent(content: string): string;
|
|
267
|
+
/**
|
|
268
|
+
* Marks the start of a named impression tracking region within content.
|
|
269
|
+
*
|
|
270
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/beginimpressionregion/)
|
|
271
|
+
*
|
|
272
|
+
* @param name - Name identifying the impression region
|
|
273
|
+
* @example
|
|
274
|
+
* Platform.Function.BeginImpressionRegion("hero-banner");
|
|
275
|
+
* Write(heroContent);
|
|
276
|
+
* Platform.Function.EndImpressionRegion();
|
|
277
|
+
*/
|
|
27
278
|
function BeginImpressionRegion(name: string): void;
|
|
279
|
+
/**
|
|
280
|
+
* Marks the end of an impression tracking region within content.
|
|
281
|
+
*
|
|
282
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/endimpressionregion/)
|
|
283
|
+
*
|
|
284
|
+
* @param closeAll - When true, closes all nested impression regions
|
|
285
|
+
* @example
|
|
286
|
+
* Platform.Function.BeginImpressionRegion("footer");
|
|
287
|
+
* Write(footerContent);
|
|
288
|
+
* Platform.Function.EndImpressionRegion();
|
|
289
|
+
*/
|
|
28
290
|
function EndImpressionRegion(closeAll?: boolean): void;
|
|
291
|
+
/**
|
|
292
|
+
* Returns the current system timestamp, or the timestamp of the triggering send when called with true.
|
|
293
|
+
*
|
|
294
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/now/)
|
|
295
|
+
*
|
|
296
|
+
* @param useContextTime - When true, returns the time the triggering send or activity was initiated. When false or omitted, returns the current system clock time.
|
|
297
|
+
* @example
|
|
298
|
+
* var current = Platform.Function.Now();
|
|
299
|
+
* Write(current); // e.g. "8/5/2025 12:00:00 PM"
|
|
300
|
+
*
|
|
301
|
+
* // Use context time during triggered sends:
|
|
302
|
+
* var sendTime = Platform.Function.Now(true);
|
|
303
|
+
*/
|
|
29
304
|
function Now(useContextTime?: boolean): string;
|
|
305
|
+
/**
|
|
306
|
+
* Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.
|
|
307
|
+
*
|
|
308
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/systemdatetolocaldate/)
|
|
309
|
+
*
|
|
310
|
+
* @param dateValue - Date-time string in system time (CST)
|
|
311
|
+
* @example
|
|
312
|
+
* var systemDate = Platform.Function.Now();
|
|
313
|
+
* var localDate = Platform.Function.SystemDateToLocalDate(systemDate);
|
|
314
|
+
* Write(localDate);
|
|
315
|
+
*/
|
|
30
316
|
function SystemDateToLocalDate(dateValue: string): string;
|
|
317
|
+
/**
|
|
318
|
+
* Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).
|
|
319
|
+
*
|
|
320
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/localdatetosystemdate/)
|
|
321
|
+
*
|
|
322
|
+
* @param dateValue - Date-time string in local account/user time
|
|
323
|
+
* @example
|
|
324
|
+
* var localDate = "8/5/2025 12:00:00 PM";
|
|
325
|
+
* var systemDate = Platform.Function.LocalDateToSystemDate(localDate);
|
|
326
|
+
* Write(systemDate);
|
|
327
|
+
*/
|
|
31
328
|
function LocalDateToSystemDate(dateValue: string): string;
|
|
329
|
+
/**
|
|
330
|
+
* Raises an error with an optional scope flag. When the second parameter is true, the error stops only the current recipient's send. When false, the error halts the entire send job.
|
|
331
|
+
*
|
|
332
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/raiseerror/)
|
|
333
|
+
*
|
|
334
|
+
* @param message - Error message describing what went wrong
|
|
335
|
+
* @param currentRecipientOnly - When true, the error applies only to the current recipient. When false, the entire send job stops.
|
|
336
|
+
* @param errorCode - Short user-defined code identifying the error type
|
|
337
|
+
* @param errorNumber - User-defined numeric error code for reference
|
|
338
|
+
* @example
|
|
339
|
+
* var status = Platform.Function.Lookup("MyDE", "Status", "Email", emailAddress);
|
|
340
|
+
* if (!status) {
|
|
341
|
+
* Platform.Function.RaiseError("Subscriber not found", true, "NOT_FOUND", 404);
|
|
342
|
+
* }
|
|
343
|
+
*/
|
|
32
344
|
function RaiseError(message: string, currentRecipientOnly?: boolean, errorCode?: string, errorNumber?: number): void;
|
|
345
|
+
/**
|
|
346
|
+
* Generates a new globally unique identifier string.
|
|
347
|
+
*
|
|
348
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/guid/)
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* var id = Platform.Function.GUID();
|
|
352
|
+
* Write(id); // e.g. "550e8400-e29b-41d4-a716-446655440000"
|
|
353
|
+
*/
|
|
33
354
|
function GUID(): string;
|
|
355
|
+
/**
|
|
356
|
+
* Checks whether a string is a valid email address format.
|
|
357
|
+
*
|
|
358
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/isemailaddress/)
|
|
359
|
+
*
|
|
360
|
+
* @param value - String to validate
|
|
361
|
+
* @example
|
|
362
|
+
* if (Platform.Function.IsEmailAddress(emailInput)) {
|
|
363
|
+
* Write("Valid email");
|
|
364
|
+
* } else {
|
|
365
|
+
* Write("Invalid email format");
|
|
366
|
+
* }
|
|
367
|
+
*/
|
|
34
368
|
function IsEmailAddress(value: string): boolean;
|
|
369
|
+
/**
|
|
370
|
+
* Evaluates whether a string contains a valid phone number.
|
|
371
|
+
*
|
|
372
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/isphonenumber/)
|
|
373
|
+
*
|
|
374
|
+
* @param value - String to evaluate
|
|
375
|
+
* @example
|
|
376
|
+
* if (Platform.Function.IsPhoneNumber(phoneInput)) {
|
|
377
|
+
* Write("Valid phone");
|
|
378
|
+
* } else {
|
|
379
|
+
* Write("Invalid phone number");
|
|
380
|
+
* }
|
|
381
|
+
*/
|
|
35
382
|
function IsPhoneNumber(value: string): boolean;
|
|
383
|
+
/**
|
|
384
|
+
* Instantiates a Marketing Cloud SOAP API object.
|
|
385
|
+
*
|
|
386
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/createobject/)
|
|
387
|
+
*
|
|
388
|
+
* @param objectType - SOAP API object type name
|
|
389
|
+
* @example
|
|
390
|
+
* var sub = Platform.Function.CreateObject("Subscriber");
|
|
391
|
+
* Platform.Function.SetObjectProperty(sub, "EmailAddress", "jane@example.com");
|
|
392
|
+
* Platform.Function.SetObjectProperty(sub, "SubscriberKey", "sk-123");
|
|
393
|
+
*/
|
|
36
394
|
function CreateObject(objectType: string): object;
|
|
395
|
+
/**
|
|
396
|
+
* Assigns a property value on a SOAP API object.
|
|
397
|
+
*
|
|
398
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/setobjectproperty/)
|
|
399
|
+
*
|
|
400
|
+
* @param apiObject - SOAP API object instance
|
|
401
|
+
* @param propertyName - Property name to set
|
|
402
|
+
* @param value - Value to assign
|
|
403
|
+
* @example
|
|
404
|
+
* var sub = Platform.Function.CreateObject("Subscriber");
|
|
405
|
+
* Platform.Function.SetObjectProperty(sub, "EmailAddress", "jane@example.com");
|
|
406
|
+
*/
|
|
37
407
|
function SetObjectProperty(apiObject: object, propertyName: string, value: any): void;
|
|
408
|
+
/**
|
|
409
|
+
* Appends an item to a SOAP API object's array property.
|
|
410
|
+
*
|
|
411
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/addobjectarrayitem/)
|
|
412
|
+
*
|
|
413
|
+
* @param apiObject - SOAP API object instance
|
|
414
|
+
* @param propertyName - Array property name
|
|
415
|
+
* @param value - Item to append
|
|
416
|
+
* @example
|
|
417
|
+
* var ts = Platform.Function.CreateObject("TriggeredSend");
|
|
418
|
+
* Platform.Function.AddObjectArrayItem(ts, "Subscribers", sub);
|
|
419
|
+
*/
|
|
38
420
|
function AddObjectArrayItem(apiObject: object, propertyName: string, value: any): void;
|
|
421
|
+
/**
|
|
422
|
+
* Executes a SOAP API Create call on an API object.
|
|
423
|
+
*
|
|
424
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokecreate/)
|
|
425
|
+
*
|
|
426
|
+
* @param apiObject - SOAP API object instance
|
|
427
|
+
* @param status - Array that receives the status and request ID of the API call (e.g. [0, 0])
|
|
428
|
+
* @param options - API configure options to include in the call. Can contain a null value.
|
|
429
|
+
* @example
|
|
430
|
+
* var StatusAndRequestID = [0, 0];
|
|
431
|
+
* var result = Platform.Function.InvokeCreate(CreateRequest, StatusAndRequestID, null);
|
|
432
|
+
* var status = StatusAndRequestID[0];
|
|
433
|
+
* var requestID = StatusAndRequestID[1];
|
|
434
|
+
*/
|
|
39
435
|
function InvokeCreate(apiObject: object, status: any[], options: object): object;
|
|
436
|
+
/**
|
|
437
|
+
* Executes a SOAP API Update call on an API object.
|
|
438
|
+
*
|
|
439
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokeupdate/)
|
|
440
|
+
*
|
|
441
|
+
* @param apiObject - SOAP API object instance
|
|
442
|
+
* @param status - Array that receives the status and request ID of the API call (e.g. [0, 0])
|
|
443
|
+
* @param options - API configure options to include in the call. Can contain a null value.
|
|
444
|
+
* @example
|
|
445
|
+
* var StatusAndRequestID = [0, 0];
|
|
446
|
+
* var result = Platform.Function.InvokeUpdate(UpdateRequest, StatusAndRequestID, null);
|
|
447
|
+
* var status = StatusAndRequestID[0];
|
|
448
|
+
* var requestID = StatusAndRequestID[1];
|
|
449
|
+
*/
|
|
40
450
|
function InvokeUpdate(apiObject: object, status: any[], options: object): object;
|
|
451
|
+
/**
|
|
452
|
+
* Executes a SOAP API Delete call on an API object.
|
|
453
|
+
*
|
|
454
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokedelete/)
|
|
455
|
+
*
|
|
456
|
+
* @param apiObject - SOAP API object instance
|
|
457
|
+
* @param status - Array that receives the status and request ID of the API call (e.g. [0, 0])
|
|
458
|
+
* @param options - API configure options to include in the call. Can contain a null value.
|
|
459
|
+
* @example
|
|
460
|
+
* var StatusAndRequestID = [0, 0];
|
|
461
|
+
* var result = Platform.Function.InvokeDelete(DeleteRequest, StatusAndRequestID, null);
|
|
462
|
+
* var status = StatusAndRequestID[0];
|
|
463
|
+
* var requestID = StatusAndRequestID[1];
|
|
464
|
+
*/
|
|
41
465
|
function InvokeDelete(apiObject: object, status: any[], options: object): object;
|
|
466
|
+
/**
|
|
467
|
+
* Executes a SOAP API Retrieve call.
|
|
468
|
+
*
|
|
469
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokeretrieve/)
|
|
470
|
+
*
|
|
471
|
+
* @param apiObject - SOAP API RetrieveRequest object instance
|
|
472
|
+
* @param status - Array that receives the status and request ID of the API call (e.g. [0, 0])
|
|
473
|
+
* @example
|
|
474
|
+
* var RetrieveRequest = Platform.Function.CreateObject("RetrieveRequest");
|
|
475
|
+
* Platform.Function.SetObjectProperty(RetrieveRequest, "ObjectType", "Email");
|
|
476
|
+
* Platform.Function.AddObjectArrayItem(RetrieveRequest, "Properties", "Email.Name");
|
|
477
|
+
* var StatusAndRequestID = [0, 0];
|
|
478
|
+
* var Emails = Platform.Function.InvokeRetrieve(RetrieveRequest, StatusAndRequestID);
|
|
479
|
+
*/
|
|
42
480
|
function InvokeRetrieve(apiObject: object, status: any[]): object;
|
|
481
|
+
/**
|
|
482
|
+
* Executes a SOAP API Perform action on an API object.
|
|
483
|
+
*
|
|
484
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokeperform/)
|
|
485
|
+
*
|
|
486
|
+
* @param apiObject - SOAP API object instance
|
|
487
|
+
* @param method - Method to perform on the object
|
|
488
|
+
* @param status - Array that receives the status, error code, and perform response of the API call (e.g. [0, 0, 0])
|
|
489
|
+
* @param options - API configure options to include in the call. Can contain a null value.
|
|
490
|
+
* @example
|
|
491
|
+
* var StatusAndRequestID = [0, 0, 0];
|
|
492
|
+
* var result = Platform.Function.InvokePerform(APIObject, "Validate", StatusAndRequestID, null);
|
|
493
|
+
* var statusMessage = StatusAndRequestID[0];
|
|
494
|
+
* var errorCode = StatusAndRequestID[1];
|
|
495
|
+
* var performResponse = StatusAndRequestID[2];
|
|
496
|
+
*/
|
|
43
497
|
function InvokePerform(apiObject: object, method: string, status: any[], options: object): object;
|
|
498
|
+
/**
|
|
499
|
+
* Executes a SOAP API Configure call on an API object.
|
|
500
|
+
*
|
|
501
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokeconfigure/)
|
|
502
|
+
*
|
|
503
|
+
* @param apiObject - SOAP API object instance
|
|
504
|
+
* @param method - Method to perform on the object
|
|
505
|
+
* @param status - Array that receives the status and request ID of the API call (e.g. [0, 0])
|
|
506
|
+
* @param options - API configure options to include in the call. Can contain a null value.
|
|
507
|
+
* @example
|
|
508
|
+
* var StatusAndRequestID = [0, 0];
|
|
509
|
+
* var result = Platform.Function.InvokeConfigure(ConfigureObject, "create", StatusAndRequestID, null);
|
|
510
|
+
*/
|
|
44
511
|
function InvokeConfigure(apiObject: object, method: string, status: any[], options: object): object;
|
|
512
|
+
/**
|
|
513
|
+
* Executes a SOAP API Execute call on an API object.
|
|
514
|
+
*
|
|
515
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokeexecute/)
|
|
516
|
+
*
|
|
517
|
+
* @param apiObject - SOAP API object instance
|
|
518
|
+
* @param status - Array that receives the status and request ID of the API call (e.g. [0, 0])
|
|
519
|
+
* @param options - API configure options to include in the call. Can contain a null value.
|
|
520
|
+
* @example
|
|
521
|
+
* var StatusAndRequestID = [0, 0];
|
|
522
|
+
* var result = Platform.Function.InvokeExecute(ExecuteRequest, StatusAndRequestID, null);
|
|
523
|
+
* var status = StatusAndRequestID[0];
|
|
524
|
+
* var requestID = StatusAndRequestID[1];
|
|
525
|
+
*/
|
|
45
526
|
function InvokeExecute(apiObject: object, status: any[], options: object): object;
|
|
527
|
+
/**
|
|
528
|
+
* Invokes the Extract SOAP API method on the specified object.
|
|
529
|
+
*
|
|
530
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokeextract/)
|
|
531
|
+
*
|
|
532
|
+
* @param apiObject - SOAP API object on which to invoke Extract
|
|
533
|
+
* @param statusArray - Array that receives the status and RequestID of the API call
|
|
534
|
+
* @param options - Additional API options; may be null
|
|
535
|
+
* @example
|
|
536
|
+
* var statusArr = [];
|
|
537
|
+
* var result = Platform.Function.InvokeExtract(extractObj, statusArr);
|
|
538
|
+
* Write(result);
|
|
539
|
+
*/
|
|
46
540
|
function InvokeExtract(apiObject: object, statusArray: any[], options?: object): string;
|
|
541
|
+
/**
|
|
542
|
+
* Invokes the Schedule SOAP API method on the specified object.
|
|
543
|
+
*
|
|
544
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/invokeschedule/)
|
|
545
|
+
*
|
|
546
|
+
* @param apiObject - SOAP API object on which to invoke Schedule
|
|
547
|
+
* @param action - Action to perform on the object
|
|
548
|
+
* @param schedule - Schedule definition object
|
|
549
|
+
* @param statusArray - Array that receives the status and RequestID of the API call
|
|
550
|
+
* @param options - Additional API options; may be null
|
|
551
|
+
* @example
|
|
552
|
+
* var statusArr = [];
|
|
553
|
+
* var result = Platform.Function.InvokeSchedule(sendDef, "start", scheduleDef, statusArr);
|
|
554
|
+
* Write(result);
|
|
555
|
+
*/
|
|
47
556
|
function InvokeSchedule(apiObject: object, action: string, schedule: object, statusArray?: any[], options?: object): string;
|
|
557
|
+
/**
|
|
558
|
+
* Performs an HTTP GET request and returns the response body. Only works with HTTP on port 80 and HTTPS on port 443. Times out after 30 seconds.
|
|
559
|
+
*
|
|
560
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/httpget/)
|
|
561
|
+
*
|
|
562
|
+
* @param url - URL to request
|
|
563
|
+
* @param continueOnError - When true, the request terminates if an error occurs. When false, the request continues on error.
|
|
564
|
+
* @param emptyContentHandling - How to handle a URL that returns empty content: 0 = allow empty, 1 = return error, 2 = skip subscriber
|
|
565
|
+
* @param headerNames - Array of header names to include in the GET request
|
|
566
|
+
* @param headerValues - Array of header values corresponding to headerNames
|
|
567
|
+
* @param statusVariable - Array that receives the status code: 0 = success, -1 = URL not found, -2 = HTTP error, -3 = success but no content
|
|
568
|
+
* @example
|
|
569
|
+
* var status = [0];
|
|
570
|
+
* var content = Platform.Function.HTTPGet(
|
|
571
|
+
* "https://api.example.com/data",
|
|
572
|
+
* false,
|
|
573
|
+
* 0,
|
|
574
|
+
* ["x-request-id"],
|
|
575
|
+
* ["sampleValue"],
|
|
576
|
+
* status
|
|
577
|
+
* );
|
|
578
|
+
* if (status[0] === 0) {
|
|
579
|
+
* var obj = Platform.Function.ParseJSON(content);
|
|
580
|
+
* }
|
|
581
|
+
*/
|
|
48
582
|
function HTTPGet(url: string, continueOnError: boolean, emptyContentHandling?: number, headerNames?: string[], headerValues?: string[], statusVariable?: number[]): string;
|
|
583
|
+
/**
|
|
584
|
+
* Performs an HTTP POST request with a content type and payload. Only works with HTTP on port 80 and HTTPS on port 443. Times out after 30 seconds. Returns the HTTP status code (e.g. 200 for success).
|
|
585
|
+
*
|
|
586
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/httppost/)
|
|
587
|
+
*
|
|
588
|
+
* @param url - URL to post to
|
|
589
|
+
* @param contentType - MIME type of the request body
|
|
590
|
+
* @param payload - Request body content
|
|
591
|
+
* @param headerNames - Array of header names
|
|
592
|
+
* @param headerValues - Array of header values corresponding to headerNames
|
|
593
|
+
* @param response - Array that receives the response body from the POST request
|
|
594
|
+
* @example
|
|
595
|
+
* var headerNames = ["Authorization"];
|
|
596
|
+
* var headerValues = ["Bearer " + accessToken];
|
|
597
|
+
* var response;
|
|
598
|
+
* var statusCode = Platform.Function.HTTPPost(
|
|
599
|
+
* "https://api.example.com/items",
|
|
600
|
+
* "application/json",
|
|
601
|
+
* Stringify({ name: "Jane", status: "active" }),
|
|
602
|
+
* headerNames,
|
|
603
|
+
* headerValues,
|
|
604
|
+
* response
|
|
605
|
+
* );
|
|
606
|
+
* if (statusCode == 200) { Write(response[0]); }
|
|
607
|
+
*/
|
|
49
608
|
function HTTPPost(url: string, contentType: string, payload: string, headerNames?: string[], headerValues?: string[], response?: any[]): number;
|
|
609
|
+
/**
|
|
610
|
+
* Parses a JSON-formatted string (or array of strings) and returns the resulting JavaScript object (or array of objects). SFMC-native equivalent of JSON.parse(), which is not available in the legacy SSJS engine.
|
|
611
|
+
*
|
|
612
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/parsejson/)
|
|
613
|
+
*
|
|
614
|
+
* @param jsonString - A valid JSON-formatted string or array of JSON strings to parse
|
|
615
|
+
* @example
|
|
616
|
+
* var jsonString = '{"name":"Jane","age":30}';
|
|
617
|
+
* var obj = Platform.Function.ParseJSON(jsonString);
|
|
618
|
+
* Write(obj.name); // outputs: Jane
|
|
619
|
+
*
|
|
620
|
+
* // Use String() to convert CLR response content before parsing:
|
|
621
|
+
* var req = new Script.Util.HttpRequest("https://api.example.com/data");
|
|
622
|
+
* req.method = "GET";
|
|
623
|
+
* var resp = req.send();
|
|
624
|
+
* var result = Platform.Function.ParseJSON(String(resp.content));
|
|
625
|
+
*/
|
|
50
626
|
function ParseJSON(jsonString: string | string[]): object | object[];
|
|
627
|
+
/**
|
|
628
|
+
* Specifies the target of an email link as a complete URL stored in an attribute, data extension field, or variable. Use only within the href attribute of an anchor tag in HTML emails. In text emails, add the http:// prefix without spaces inside the parentheses. Include anchor tags in the email body (not in retrieved link content) to retain click-tracking.
|
|
629
|
+
*
|
|
630
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/redirectto/)
|
|
631
|
+
*
|
|
632
|
+
* @param url - The URL to redirect to
|
|
633
|
+
* @example
|
|
634
|
+
* var email = "aruiz@example.com";
|
|
635
|
+
* var firstName = "Angela";
|
|
636
|
+
* var baseUrl = "https://example.com?email=";
|
|
637
|
+
* var nameJoin = "&name=";
|
|
638
|
+
* Platform.Function.RedirectTo(baseUrl.concat(email, nameJoin, firstName));
|
|
639
|
+
* // Use inside href: <a href="%%=RedirectTo(...)=%%">link</a>
|
|
640
|
+
*/
|
|
51
641
|
function RedirectTo(url: string): void;
|
|
642
|
+
/**
|
|
643
|
+
* Percent-encodes a complete URL. When encodeReservedKeywords is false (default), only space characters are encoded as %20. When true, all URL-reserved characters are also encoded (spaces become +).
|
|
644
|
+
*
|
|
645
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/urlencode/)
|
|
646
|
+
*
|
|
647
|
+
* @param url - The complete URL to encode
|
|
648
|
+
* @param encodeReservedKeywords - When true, encodes all reserved characters; spaces become +. When false (default), only spaces are encoded as %20.
|
|
649
|
+
* @example
|
|
650
|
+
* var baseURL = "http://www.example.com?value=12+3 12;3";
|
|
651
|
+
* var encoded = Platform.Function.UrlEncode(baseURL);
|
|
652
|
+
* Write(encoded); // "http://www.example.com?value=12+3%2012;3"
|
|
653
|
+
* var encodedFull = Platform.Function.UrlEncode(baseURL, true);
|
|
654
|
+
* Write(encodedFull); // "http://www.example.com?value%3d12%2b3+12%3b3"
|
|
655
|
+
*/
|
|
52
656
|
function UrlEncode(url: string, encodeReservedKeywords?: boolean): string;
|
|
657
|
+
/**
|
|
658
|
+
* Encodes any string value to Base64. Note: values encoded with this function can only be decoded using `Platform.Function.Base64Decode()` or `Base64Decode()` — not other Base64 decoders. For a simpler single-parameter form without charset control, see `Base64Encode()`.
|
|
659
|
+
*
|
|
660
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/base64encode/)
|
|
661
|
+
*
|
|
662
|
+
* @param string - String to encode
|
|
663
|
+
* @param charset - Character set to use when encoding, such as ASCII or UTF-8
|
|
664
|
+
* @example
|
|
665
|
+
* var normalStr = Platform.Function.Lookup("ForBase64Info","ReceiptData","ReceiptKey","stringValue");
|
|
666
|
+
* var encodedStr = Platform.Function.Base64Encode(normalStr);
|
|
667
|
+
*/
|
|
53
668
|
function Base64Encode(string: string, charset?: string): string;
|
|
669
|
+
/**
|
|
670
|
+
* Decodes a Base64-encoded string. Only works with values encoded using `Platform.Function.Base64Encode()` or `Base64Encode()` — not arbitrary Base64 strings. For a simpler single-parameter form without charset control, see `Base64Decode()`.
|
|
671
|
+
*
|
|
672
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/base64decode/)
|
|
673
|
+
*
|
|
674
|
+
* @param encodedString - Base64 encoded string to decode
|
|
675
|
+
* @param charset - Character set to use when decoding, such as ASCII or UTF-8
|
|
676
|
+
* @example
|
|
677
|
+
* var encodedStr = Platform.Function.Lookup("forBase64Info","ReceiptData","ReceiptKey","stringValue");
|
|
678
|
+
* var decodedStr = Platform.Function.Base64Decode(encodedStr);
|
|
679
|
+
*/
|
|
54
680
|
function Base64Decode(encodedString: string, charset?: string): string;
|
|
681
|
+
/**
|
|
682
|
+
* Returns an MD5 hash for a given string value.
|
|
683
|
+
*
|
|
684
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/md5/)
|
|
685
|
+
*
|
|
686
|
+
* @param string - String to evaluate
|
|
687
|
+
* @param charset - Character set to use when evaluating, such as ASCII or UTF-8
|
|
688
|
+
* @example
|
|
689
|
+
* var normalStr = Platform.Function.Lookup("ForMD5Info","HashData","HashKey","stringValue");
|
|
690
|
+
* var hashedStr = Platform.Function.MD5(normalStr);
|
|
691
|
+
*/
|
|
55
692
|
function MD5(string: string, charset?: string): string;
|
|
693
|
+
/**
|
|
694
|
+
* Converts a JavaScript object into its JSON string representation. Works only with known JSON-serializable types. Not to be confused with `String()`, which converts CLR response objects to plain strings.
|
|
695
|
+
*
|
|
696
|
+
* [ssjs.guide reference](https://ssjs.guide/global-functions/stringify/)
|
|
697
|
+
*
|
|
698
|
+
* @param object - JavaScript object to serialize to JSON.
|
|
699
|
+
* @returns JSON string representation of the object.
|
|
700
|
+
* @example
|
|
701
|
+
* var json = Platform.Function.Stringify({ name: "Jane", age: 30 });
|
|
702
|
+
* Platform.Function.Write(json);
|
|
703
|
+
*/
|
|
56
704
|
function Stringify(object: object): string;
|
|
57
705
|
/**
|
|
706
|
+
* Retrieves content from a specified classic Content Area by numeric ID. Deprecated — Content Areas are no longer supported on current SFMC infrastructure.
|
|
707
|
+
*
|
|
708
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentarea/)
|
|
709
|
+
*
|
|
58
710
|
* @deprecated
|
|
711
|
+
* @param id - Numeric ID of the Content Area.
|
|
712
|
+
* @param regionName - Impression region for content.
|
|
713
|
+
* @param stopOnError - When true, throws on failure; when false the call proceeds.
|
|
714
|
+
* @param fallbackContent - Default content to display when the area cannot be retrieved.
|
|
715
|
+
* @returns Rendered content from the Content Area.
|
|
716
|
+
* @example
|
|
717
|
+
* var content = Platform.Function.ContentArea(123456, "impressionRegion", false, "defaultContentHere");
|
|
59
718
|
*/
|
|
60
719
|
function ContentArea(id: number, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
|
|
61
720
|
/**
|
|
721
|
+
* Retrieves content from a specified classic Content Area by name. Deprecated — Content Areas are no longer supported on current SFMC infrastructure.
|
|
722
|
+
*
|
|
723
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentareabyname/)
|
|
724
|
+
*
|
|
62
725
|
* @deprecated
|
|
726
|
+
* @param name - Name of the Content Area.
|
|
727
|
+
* @param regionName - Impression region for content.
|
|
728
|
+
* @param stopOnError - When true, throws on failure; when false the call proceeds.
|
|
729
|
+
* @param fallbackContent - Default content to display when the area cannot be retrieved.
|
|
730
|
+
* @returns Rendered content from the Content Area.
|
|
731
|
+
* @example
|
|
732
|
+
* var content = Platform.Function.ContentAreaByName("My Content\\myContentArea", "impressionRegion", false, "defaultContentHere");
|
|
63
733
|
*/
|
|
64
734
|
function ContentAreaByName(name: string, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
|
|
735
|
+
/**
|
|
736
|
+
* Indicates whether the passed-in user-agent value represents a CHTML browser. CHTML browsers (e.g. feature phones) use a modified version of HTML. Returns true when the user agent is a CHTML browser.
|
|
737
|
+
*
|
|
738
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/ischtmlbrowser/)
|
|
739
|
+
*
|
|
740
|
+
* @param userAgentString - User-agent string to evaluate.
|
|
741
|
+
* @returns True if the user agent represents a CHTML browser.
|
|
742
|
+
* @example
|
|
743
|
+
* Platform.Response.Write(Platform.Request.UserAgent);
|
|
744
|
+
* Platform.Response.Write("<br>Is CHTML: ");
|
|
745
|
+
* Platform.Response.Write(Platform.Function.IsCHTMLBrowser(Platform.Request.UserAgent));
|
|
746
|
+
*/
|
|
65
747
|
function IsCHTMLBrowser(userAgentString: string): boolean;
|
|
66
748
|
}
|
|
67
749
|
namespace Variable {
|
|
750
|
+
/**
|
|
751
|
+
* Retrieves the value of an AMPscript variable from the SSJS context.
|
|
752
|
+
*
|
|
753
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-variable/)
|
|
754
|
+
*
|
|
755
|
+
* @param variableName - Name of the AMPscript variable
|
|
756
|
+
* @example
|
|
757
|
+
* var sk = Platform.Variable.GetValue("SubscriberKey");
|
|
758
|
+
* Write(sk);
|
|
759
|
+
* // Bare-name alias: Variable.GetValue("SubscriberKey")
|
|
760
|
+
*/
|
|
68
761
|
function GetValue(variableName: string): string;
|
|
762
|
+
/**
|
|
763
|
+
* Assigns a value to an AMPscript variable from the SSJS context.
|
|
764
|
+
*
|
|
765
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-variable/)
|
|
766
|
+
*
|
|
767
|
+
* @param variableName - Name of the AMPscript variable
|
|
768
|
+
* @param value - Value to assign
|
|
769
|
+
* @example
|
|
770
|
+
* Platform.Variable.SetValue("greeting", "Hello from SSJS");
|
|
771
|
+
* // @greeting is now available in subsequent AMPscript blocks
|
|
772
|
+
* // Bare-name alias: Variable.SetValue("greeting", "Hello from SSJS")
|
|
773
|
+
*/
|
|
69
774
|
function SetValue(variableName: string, value: string): void;
|
|
70
775
|
}
|
|
71
776
|
namespace Response {
|
|
777
|
+
/**
|
|
778
|
+
* Sets a response header on the current page response.
|
|
779
|
+
*
|
|
780
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-response/)
|
|
781
|
+
*
|
|
782
|
+
* @param headerName - Name of the response header.
|
|
783
|
+
* @param value - Value for the response header.
|
|
784
|
+
* @example
|
|
785
|
+
* Platform.Response.SetResponseHeader("Content-Type", "application/json");
|
|
786
|
+
* Platform.Response.Write(Stringify({ status: "ok" }));
|
|
787
|
+
*/
|
|
72
788
|
function SetResponseHeader(headerName: string, value: string): void;
|
|
789
|
+
/**
|
|
790
|
+
* Removes a previously set HTTP response header from the response.
|
|
791
|
+
*
|
|
792
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-response/)
|
|
793
|
+
*
|
|
794
|
+
* @param headerName - Name of the HTTP response header to remove.
|
|
795
|
+
* @example
|
|
796
|
+
* Platform.Response.RemoveResponseHeader("X-Powered-By");
|
|
797
|
+
*/
|
|
73
798
|
function RemoveResponseHeader(headerName: string): void;
|
|
799
|
+
/**
|
|
800
|
+
* Redirects the current page to a new URL. Pass false for a 302 temporary redirect or true for a 301 permanent redirect. Do not use 301 if you want browsers to re-check the original URL later.
|
|
801
|
+
*
|
|
802
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-response/)
|
|
803
|
+
*
|
|
804
|
+
* @param url - URL to redirect to.
|
|
805
|
+
* @param movedPermanently - True for 301 permanent redirect, false for 302 temporary.
|
|
806
|
+
* @example
|
|
807
|
+
* Platform.Response.Redirect("https://pub.pages.example.com/thank-you", false);
|
|
808
|
+
*/
|
|
74
809
|
function Redirect(url: string, movedPermanently: boolean): void;
|
|
810
|
+
/**
|
|
811
|
+
* Sets a cookie on the client browser response.
|
|
812
|
+
*
|
|
813
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-response/)
|
|
814
|
+
*
|
|
815
|
+
* @param name - Name of the cookie to set.
|
|
816
|
+
* @param value - Value to store in the cookie.
|
|
817
|
+
* @param expires - Expiration date/time for the cookie.
|
|
818
|
+
* @param secure - If true, the cookie is only sent over HTTPS.
|
|
819
|
+
* @example
|
|
820
|
+
* Platform.Response.SetCookie("userId", subscriberKey, "12/31/2025", true);
|
|
821
|
+
*/
|
|
75
822
|
function SetCookie(name: string, value: string, expires?: string, secure?: boolean): void;
|
|
823
|
+
/**
|
|
824
|
+
* Removes a cookie from the client browser by setting its expiration to a past date.
|
|
825
|
+
*
|
|
826
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-response/)
|
|
827
|
+
*
|
|
828
|
+
* @param name - Name of the cookie to remove.
|
|
829
|
+
* @example
|
|
830
|
+
* Platform.Response.RemoveCookie("userId");
|
|
831
|
+
*/
|
|
76
832
|
function RemoveCookie(name: string): void;
|
|
833
|
+
/**
|
|
834
|
+
* Writes content to the HTTP response output. Distinct from the bare-name `Write()``, which write to the rendered page output.
|
|
835
|
+
*
|
|
836
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-response/)
|
|
837
|
+
*
|
|
838
|
+
* @param content - Content string to write to the response.
|
|
839
|
+
* @example
|
|
840
|
+
* var data = { name: "Jane", status: "active" };
|
|
841
|
+
* Platform.Response.Write(Stringify(data));
|
|
842
|
+
*/
|
|
77
843
|
function Write(content: string): void;
|
|
78
844
|
var ContentType: string;
|
|
79
845
|
var CharacterSet: string;
|
|
80
846
|
}
|
|
81
847
|
namespace Request {
|
|
848
|
+
/**
|
|
849
|
+
* Retrieves the value of a URL query string parameter.
|
|
850
|
+
*
|
|
851
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
852
|
+
*
|
|
853
|
+
* @param parameterName - Name of the query string parameter.
|
|
854
|
+
* @example
|
|
855
|
+
* // Page URL: /mypage?email=jane@example.com
|
|
856
|
+
* var email = Platform.Request.GetQueryStringParameter("email");
|
|
857
|
+
* Write(email);
|
|
858
|
+
*/
|
|
82
859
|
function GetQueryStringParameter(parameterName: string): string;
|
|
860
|
+
/**
|
|
861
|
+
* Retrieves data from a named form field, including values sent via POST.
|
|
862
|
+
*
|
|
863
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
864
|
+
*
|
|
865
|
+
* @param name - Name of the form field to retrieve.
|
|
866
|
+
* @example
|
|
867
|
+
* var email = Platform.Request.GetFormField("emailAddress");
|
|
868
|
+
* Write(email);
|
|
869
|
+
*/
|
|
83
870
|
function GetFormField(name: string): string;
|
|
871
|
+
/**
|
|
872
|
+
* Returns the raw body of the HTTP POST request. CAVEAT: Only returns data on the FIRST call per request; subsequent calls return nothing. Store the result in a variable if you need it multiple times.
|
|
873
|
+
*
|
|
874
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
875
|
+
*
|
|
876
|
+
* @param encoding - Character encoding for the post data.
|
|
877
|
+
* @example
|
|
878
|
+
* // Read raw POST body once and store it:
|
|
879
|
+
* var rawBody = Platform.Request.GetPostData();
|
|
880
|
+
* var payload = Platform.Function.ParseJSON(rawBody);
|
|
881
|
+
*/
|
|
84
882
|
function GetPostData(encoding?: string): string;
|
|
883
|
+
/**
|
|
884
|
+
* Retrieves the value of a named cookie from the HTTP request sent by the client browser.
|
|
885
|
+
*
|
|
886
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
887
|
+
*
|
|
888
|
+
* @param cookieName - Name of the cookie to retrieve.
|
|
889
|
+
* @example
|
|
890
|
+
* var sessionId = Platform.Request.GetCookieValue("sessionId");
|
|
891
|
+
* if (sessionId) { Write("Session: " + sessionId); }
|
|
892
|
+
*/
|
|
85
893
|
function GetCookieValue(cookieName: string): string;
|
|
894
|
+
/**
|
|
895
|
+
* Returns the language preferences of the client browser as specified in the HTTP Accept-Language request header.
|
|
896
|
+
*
|
|
897
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
898
|
+
*
|
|
899
|
+
* @example
|
|
900
|
+
* var lang = Platform.Request.GetUserLanguages();
|
|
901
|
+
* Write(lang); // e.g. "en-US,en;q=0.9"
|
|
902
|
+
*/
|
|
86
903
|
function GetUserLanguages(): string;
|
|
904
|
+
/**
|
|
905
|
+
* Returns the value of the named HTTP request header, or null if not present.
|
|
906
|
+
*
|
|
907
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
908
|
+
*
|
|
909
|
+
* @param headerName - Name of the HTTP request header to retrieve.
|
|
910
|
+
* @example
|
|
911
|
+
* var auth = Platform.Request.GetRequestHeader("Authorization");
|
|
912
|
+
* if (auth) { Write("Auth: " + auth); }
|
|
913
|
+
*/
|
|
87
914
|
function GetRequestHeader(headerName: string): string;
|
|
88
915
|
const Browser: object;
|
|
89
916
|
const ClientIP: string;
|
|
@@ -96,653 +923,2383 @@ declare namespace Platform {
|
|
|
96
923
|
const UserAgent: string;
|
|
97
924
|
}
|
|
98
925
|
namespace Recipient {
|
|
926
|
+
/**
|
|
927
|
+
* Returns the value of a subscriber attribute or sendable data extension field for the current recipient.
|
|
928
|
+
*
|
|
929
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-recipient/)
|
|
930
|
+
*
|
|
931
|
+
* @param attributeName - Name of the subscriber attribute or sendable DE field to retrieve
|
|
932
|
+
* @example
|
|
933
|
+
* var email = Platform.Recipient.GetAttributeValue("EmailAddress");
|
|
934
|
+
* Platform.Response.Write(email);
|
|
935
|
+
*/
|
|
99
936
|
function GetAttributeValue(attributeName: string): string;
|
|
100
937
|
}
|
|
101
938
|
}
|
|
102
939
|
|
|
103
940
|
// ── Bare-name globals (aliasOf Platform.*) ──────────────────────────────────
|
|
941
|
+
declare namespace Variable {
|
|
942
|
+
/**
|
|
943
|
+
* Retrieves the value of an AMPscript variable from the SSJS context.
|
|
944
|
+
*
|
|
945
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-variable/)
|
|
946
|
+
*
|
|
947
|
+
* @param variableName - Name of the AMPscript variable
|
|
948
|
+
* @example
|
|
949
|
+
* var sk = Platform.Variable.GetValue("SubscriberKey");
|
|
950
|
+
* Write(sk);
|
|
951
|
+
* // Bare-name alias: Variable.GetValue("SubscriberKey")
|
|
952
|
+
*/
|
|
953
|
+
function GetValue(variableName: string): string;
|
|
954
|
+
/**
|
|
955
|
+
* Assigns a value to an AMPscript variable from the SSJS context.
|
|
956
|
+
*
|
|
957
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-variable/)
|
|
958
|
+
*
|
|
959
|
+
* @param variableName - Name of the AMPscript variable
|
|
960
|
+
* @param value - Value to assign
|
|
961
|
+
* @example
|
|
962
|
+
* Platform.Variable.SetValue("greeting", "Hello from SSJS");
|
|
963
|
+
* // @greeting is now available in subsequent AMPscript blocks
|
|
964
|
+
* // Bare-name alias: Variable.SetValue("greeting", "Hello from SSJS")
|
|
965
|
+
*/
|
|
966
|
+
function SetValue(variableName: string, value: string): void;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
declare namespace Request {
|
|
970
|
+
/**
|
|
971
|
+
* Retrieves the value of a URL query string parameter.
|
|
972
|
+
*
|
|
973
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
974
|
+
*
|
|
975
|
+
* @param parameterName - Name of the query string parameter.
|
|
976
|
+
* @example
|
|
977
|
+
* // Page URL: /mypage?email=jane@example.com
|
|
978
|
+
* var email = Platform.Request.GetQueryStringParameter("email");
|
|
979
|
+
* Write(email);
|
|
980
|
+
*/
|
|
981
|
+
function GetQueryStringParameter(parameterName: string): string;
|
|
982
|
+
/**
|
|
983
|
+
* Retrieves data from a named form field, including values sent via POST.
|
|
984
|
+
*
|
|
985
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
986
|
+
*
|
|
987
|
+
* @param name - Name of the form field to retrieve.
|
|
988
|
+
* @example
|
|
989
|
+
* var email = Platform.Request.GetFormField("emailAddress");
|
|
990
|
+
* Write(email);
|
|
991
|
+
*/
|
|
992
|
+
function GetFormField(name: string): string;
|
|
993
|
+
/**
|
|
994
|
+
* Returns the raw body of the HTTP POST request. CAVEAT: Only returns data on the FIRST call per request; subsequent calls return nothing. Store the result in a variable if you need it multiple times.
|
|
995
|
+
*
|
|
996
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
997
|
+
*
|
|
998
|
+
* @param encoding - Character encoding for the post data.
|
|
999
|
+
* @example
|
|
1000
|
+
* // Read raw POST body once and store it:
|
|
1001
|
+
* var rawBody = Platform.Request.GetPostData();
|
|
1002
|
+
* var payload = Platform.Function.ParseJSON(rawBody);
|
|
1003
|
+
*/
|
|
1004
|
+
function GetPostData(encoding?: string): string;
|
|
1005
|
+
/**
|
|
1006
|
+
* Retrieves the value of a named cookie from the HTTP request sent by the client browser.
|
|
1007
|
+
*
|
|
1008
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1009
|
+
*
|
|
1010
|
+
* @param cookieName - Name of the cookie to retrieve.
|
|
1011
|
+
* @example
|
|
1012
|
+
* var sessionId = Platform.Request.GetCookieValue("sessionId");
|
|
1013
|
+
* if (sessionId) { Write("Session: " + sessionId); }
|
|
1014
|
+
*/
|
|
1015
|
+
function GetCookieValue(cookieName: string): string;
|
|
1016
|
+
/**
|
|
1017
|
+
* Returns the language preferences of the client browser as specified in the HTTP Accept-Language request header.
|
|
1018
|
+
*
|
|
1019
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1020
|
+
*
|
|
1021
|
+
* @example
|
|
1022
|
+
* var lang = Platform.Request.GetUserLanguages();
|
|
1023
|
+
* Write(lang); // e.g. "en-US,en;q=0.9"
|
|
1024
|
+
*/
|
|
1025
|
+
function GetUserLanguages(): string;
|
|
1026
|
+
/**
|
|
1027
|
+
* Returns the value of the named HTTP request header, or null if not present.
|
|
1028
|
+
*
|
|
1029
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1030
|
+
*
|
|
1031
|
+
* @param headerName - Name of the HTTP request header to retrieve.
|
|
1032
|
+
* @example
|
|
1033
|
+
* var auth = Platform.Request.GetRequestHeader("Authorization");
|
|
1034
|
+
* if (auth) { Write("Auth: " + auth); }
|
|
1035
|
+
*/
|
|
1036
|
+
function GetRequestHeader(headerName: string): string;
|
|
1037
|
+
/**
|
|
1038
|
+
* Returns an object describing the client browser.
|
|
1039
|
+
*
|
|
1040
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1041
|
+
*
|
|
1042
|
+
* @example
|
|
1043
|
+
* var browser = Platform.Request.Browser;
|
|
1044
|
+
* Write(Stringify(browser));
|
|
1045
|
+
*/
|
|
1046
|
+
var Browser: object;
|
|
1047
|
+
/**
|
|
1048
|
+
* Returns the IP address of the client.
|
|
1049
|
+
*
|
|
1050
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1051
|
+
*
|
|
1052
|
+
* @example
|
|
1053
|
+
* Write(Platform.Request.ClientIP);
|
|
1054
|
+
*/
|
|
1055
|
+
var ClientIP: string;
|
|
1056
|
+
/**
|
|
1057
|
+
* Returns true if the current request was made over HTTPS.
|
|
1058
|
+
*
|
|
1059
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1060
|
+
*
|
|
1061
|
+
* @example
|
|
1062
|
+
* if (Platform.Request.HasSSL) {
|
|
1063
|
+
* Write("Secure connection");
|
|
1064
|
+
* } else {
|
|
1065
|
+
* Platform.Response.Redirect("https://" + Platform.Request.RequestURL);
|
|
1066
|
+
* }
|
|
1067
|
+
*/
|
|
1068
|
+
var HasSSL: boolean;
|
|
1069
|
+
/**
|
|
1070
|
+
* Returns true if the current request was made over HTTPS (alias of HasSSL).
|
|
1071
|
+
*
|
|
1072
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1073
|
+
*
|
|
1074
|
+
* @example
|
|
1075
|
+
* Write(Platform.Request.IsSSL);
|
|
1076
|
+
*/
|
|
1077
|
+
var IsSSL: boolean;
|
|
1078
|
+
/**
|
|
1079
|
+
* Returns the HTTP method (GET, POST, etc.) of the current request.
|
|
1080
|
+
*
|
|
1081
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1082
|
+
*
|
|
1083
|
+
* @example
|
|
1084
|
+
* var method = Platform.Request.Method;
|
|
1085
|
+
* if (method === "POST") {
|
|
1086
|
+
* var body = Platform.Request.GetPostData();
|
|
1087
|
+
* // handle POST
|
|
1088
|
+
* }
|
|
1089
|
+
*/
|
|
1090
|
+
var Method: string;
|
|
1091
|
+
/**
|
|
1092
|
+
* Returns the full query string of the current request URL.
|
|
1093
|
+
*
|
|
1094
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1095
|
+
*
|
|
1096
|
+
* @example
|
|
1097
|
+
* Write(Platform.Request.QueryString);
|
|
1098
|
+
*/
|
|
1099
|
+
var QueryString: string;
|
|
1100
|
+
/**
|
|
1101
|
+
* Returns the referrer URL from the HTTP Referer header.
|
|
1102
|
+
*
|
|
1103
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1104
|
+
*
|
|
1105
|
+
* @example
|
|
1106
|
+
* Write(Platform.Request.ReferrerURL);
|
|
1107
|
+
*/
|
|
1108
|
+
var ReferrerURL: string;
|
|
1109
|
+
/**
|
|
1110
|
+
* Returns the full URL of the current page request.
|
|
1111
|
+
*
|
|
1112
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1113
|
+
*
|
|
1114
|
+
* @example
|
|
1115
|
+
* Write("Current page: " + Platform.Request.RequestURL);
|
|
1116
|
+
*/
|
|
1117
|
+
var RequestURL: string;
|
|
1118
|
+
/**
|
|
1119
|
+
* Returns the user-agent string from the HTTP request.
|
|
1120
|
+
*
|
|
1121
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
|
|
1122
|
+
*
|
|
1123
|
+
* @example
|
|
1124
|
+
* Write(Platform.Request.UserAgent);
|
|
1125
|
+
*/
|
|
1126
|
+
var UserAgent: string;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
declare namespace Recipient {
|
|
1130
|
+
/**
|
|
1131
|
+
* Returns the value of a subscriber attribute or sendable data extension field for the current recipient.
|
|
1132
|
+
*
|
|
1133
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-recipient/)
|
|
1134
|
+
*
|
|
1135
|
+
* @param attributeName - Name of the subscriber attribute or sendable DE field to retrieve
|
|
1136
|
+
* @example
|
|
1137
|
+
* var email = Platform.Recipient.GetAttributeValue("EmailAddress");
|
|
1138
|
+
* Platform.Response.Write(email);
|
|
1139
|
+
*/
|
|
1140
|
+
function GetAttributeValue(attributeName: string): string;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
104
1143
|
/**
|
|
1144
|
+
* Retrieves content from a specified classic Content Area by numeric ID. Deprecated — Content Areas are no longer supported on current SFMC infrastructure.
|
|
1145
|
+
*
|
|
1146
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentarea/)
|
|
1147
|
+
*
|
|
105
1148
|
* @deprecated
|
|
1149
|
+
* @param id - Numeric ID of the Content Area.
|
|
1150
|
+
* @param regionName - Impression region for content.
|
|
1151
|
+
* @param stopOnError - When true, throws on failure; when false the call proceeds.
|
|
1152
|
+
* @param fallbackContent - Default content to display when the area cannot be retrieved.
|
|
1153
|
+
* @returns Rendered content from the Content Area.
|
|
1154
|
+
* @example
|
|
1155
|
+
* var content = Platform.Function.ContentArea(123456, "impressionRegion", false, "defaultContentHere");
|
|
106
1156
|
*/
|
|
107
1157
|
declare function ContentArea(id: number, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
|
|
108
1158
|
/**
|
|
1159
|
+
* Retrieves content from a specified classic Content Area by name. Deprecated — Content Areas are no longer supported on current SFMC infrastructure.
|
|
1160
|
+
*
|
|
1161
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/contentareabyname/)
|
|
1162
|
+
*
|
|
109
1163
|
* @deprecated
|
|
1164
|
+
* @param name - Name of the Content Area.
|
|
1165
|
+
* @param regionName - Impression region for content.
|
|
1166
|
+
* @param stopOnError - When true, throws on failure; when false the call proceeds.
|
|
1167
|
+
* @param fallbackContent - Default content to display when the area cannot be retrieved.
|
|
1168
|
+
* @returns Rendered content from the Content Area.
|
|
1169
|
+
* @example
|
|
1170
|
+
* var content = Platform.Function.ContentAreaByName("My Content\\myContentArea", "impressionRegion", false, "defaultContentHere");
|
|
110
1171
|
*/
|
|
111
1172
|
declare function ContentAreaByName(name: string, regionName?: string, stopOnError?: boolean, fallbackContent?: string): string;
|
|
112
1173
|
/**
|
|
1174
|
+
* Marks the start of a named impression tracking region within content.
|
|
1175
|
+
*
|
|
1176
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/beginimpressionregion/)
|
|
1177
|
+
*
|
|
113
1178
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1179
|
+
* @param name - Name identifying the impression region
|
|
1180
|
+
* @example
|
|
1181
|
+
* Platform.Function.BeginImpressionRegion("hero-banner");
|
|
1182
|
+
* Write(heroContent);
|
|
1183
|
+
* Platform.Function.EndImpressionRegion();
|
|
114
1184
|
*/
|
|
115
1185
|
declare function BeginImpressionRegion(name: string): void;
|
|
116
1186
|
/**
|
|
1187
|
+
* Marks the end of an impression tracking region within content.
|
|
1188
|
+
*
|
|
1189
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/endimpressionregion/)
|
|
1190
|
+
*
|
|
117
1191
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1192
|
+
* @param closeAll - When true, closes all nested impression regions
|
|
1193
|
+
* @example
|
|
1194
|
+
* Platform.Function.BeginImpressionRegion("footer");
|
|
1195
|
+
* Write(footerContent);
|
|
1196
|
+
* Platform.Function.EndImpressionRegion();
|
|
118
1197
|
*/
|
|
119
1198
|
declare function EndImpressionRegion(closeAll?: boolean): void;
|
|
120
1199
|
/**
|
|
1200
|
+
* Returns the current system timestamp, or the timestamp of the triggering send when called with true.
|
|
1201
|
+
*
|
|
1202
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/now/)
|
|
1203
|
+
*
|
|
121
1204
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1205
|
+
* @param useContextTime - When true, returns the time the triggering send or activity was initiated. When false or omitted, returns the current system clock time.
|
|
1206
|
+
* @example
|
|
1207
|
+
* var current = Platform.Function.Now();
|
|
1208
|
+
* Write(current); // e.g. "8/5/2025 12:00:00 PM"
|
|
1209
|
+
*
|
|
1210
|
+
* // Use context time during triggered sends:
|
|
1211
|
+
* var sendTime = Platform.Function.Now(true);
|
|
122
1212
|
*/
|
|
123
1213
|
declare function Now(useContextTime?: boolean): string;
|
|
124
1214
|
/**
|
|
1215
|
+
* Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.
|
|
1216
|
+
*
|
|
1217
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/systemdatetolocaldate/)
|
|
1218
|
+
*
|
|
125
1219
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1220
|
+
* @param dateValue - Date-time string in system time (CST)
|
|
1221
|
+
* @example
|
|
1222
|
+
* var systemDate = Platform.Function.Now();
|
|
1223
|
+
* var localDate = Platform.Function.SystemDateToLocalDate(systemDate);
|
|
1224
|
+
* Write(localDate);
|
|
126
1225
|
*/
|
|
127
1226
|
declare function SystemDateToLocalDate(dateValue: string): string;
|
|
128
1227
|
/**
|
|
1228
|
+
* Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).
|
|
1229
|
+
*
|
|
1230
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/localdatetosystemdate/)
|
|
1231
|
+
*
|
|
129
1232
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1233
|
+
* @param dateValue - Date-time string in local account/user time
|
|
1234
|
+
* @example
|
|
1235
|
+
* var localDate = "8/5/2025 12:00:00 PM";
|
|
1236
|
+
* var systemDate = Platform.Function.LocalDateToSystemDate(localDate);
|
|
1237
|
+
* Write(systemDate);
|
|
130
1238
|
*/
|
|
131
1239
|
declare function LocalDateToSystemDate(dateValue: string): string;
|
|
132
1240
|
/**
|
|
1241
|
+
* Redirects the current page to a new URL. Pass false for a 302 temporary redirect or true for a 301 permanent redirect. Do not use 301 if you want browsers to re-check the original URL later.
|
|
1242
|
+
*
|
|
1243
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-response/redirect/)
|
|
1244
|
+
*
|
|
133
1245
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1246
|
+
* @param url - URL to redirect to.
|
|
1247
|
+
* @param movedPermanently - True for 301 permanent redirect, false for 302 temporary.
|
|
1248
|
+
* @example
|
|
1249
|
+
* Platform.Response.Redirect("https://pub.pages.example.com/thank-you", false);
|
|
134
1250
|
*/
|
|
135
1251
|
declare function Redirect(url: string, movedPermanently: boolean): void;
|
|
136
1252
|
/**
|
|
1253
|
+
* Generates a new globally unique identifier string.
|
|
1254
|
+
*
|
|
1255
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/guid/)
|
|
1256
|
+
*
|
|
137
1257
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1258
|
+
* @example
|
|
1259
|
+
* var id = Platform.Function.GUID();
|
|
1260
|
+
* Write(id); // e.g. "550e8400-e29b-41d4-a716-446655440000"
|
|
138
1261
|
*/
|
|
139
1262
|
declare function GUID(): string;
|
|
140
1263
|
/**
|
|
1264
|
+
* Checks whether a string is a valid email address format.
|
|
1265
|
+
*
|
|
1266
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/isemailaddress/)
|
|
1267
|
+
*
|
|
141
1268
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1269
|
+
* @param value - String to validate
|
|
1270
|
+
* @example
|
|
1271
|
+
* if (Platform.Function.IsEmailAddress(emailInput)) {
|
|
1272
|
+
* Write("Valid email");
|
|
1273
|
+
* } else {
|
|
1274
|
+
* Write("Invalid email format");
|
|
1275
|
+
* }
|
|
142
1276
|
*/
|
|
143
1277
|
declare function IsEmailAddress(value: string): boolean;
|
|
144
1278
|
/**
|
|
1279
|
+
* Evaluates whether a string contains a valid phone number.
|
|
1280
|
+
*
|
|
1281
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-functions/isphonenumber/)
|
|
1282
|
+
*
|
|
145
1283
|
* @remarks Requires `Platform.Load("Core", "1")` before use.
|
|
1284
|
+
* @param value - String to evaluate
|
|
1285
|
+
* @example
|
|
1286
|
+
* if (Platform.Function.IsPhoneNumber(phoneInput)) {
|
|
1287
|
+
* Write("Valid phone");
|
|
1288
|
+
* } else {
|
|
1289
|
+
* Write("Invalid phone number");
|
|
1290
|
+
* }
|
|
146
1291
|
*/
|
|
147
1292
|
declare function IsPhoneNumber(value: string): boolean;
|
|
148
1293
|
/**
|
|
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
|
+
*
|
|
149
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));
|
|
150
1303
|
*/
|
|
151
1304
|
declare function Write(content: string): void;
|
|
152
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
|
+
*
|
|
153
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);
|
|
154
1316
|
*/
|
|
155
1317
|
declare function Stringify(object: object): string;
|
|
156
1318
|
|
|
157
1319
|
// ── DataExtension instance interfaces ───────────────────────────────────────
|
|
158
|
-
interface
|
|
1320
|
+
interface DataExtensionFields {
|
|
159
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
|
+
*
|
|
160
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);
|
|
161
1332
|
*/
|
|
162
1333
|
Add(properties: object): string;
|
|
163
1334
|
/**
|
|
1335
|
+
* Returns an array of field definitions for the previously initialized data extension.
|
|
1336
|
+
*
|
|
164
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();
|
|
165
1343
|
*/
|
|
166
1344
|
Retrieve(): object[];
|
|
167
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
|
+
*
|
|
168
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");
|
|
169
1356
|
*/
|
|
170
1357
|
UpdateSendableField(deFieldName: string, subscriberField: string): string;
|
|
171
1358
|
}
|
|
172
|
-
interface
|
|
173
|
-
/**
|
|
174
|
-
*
|
|
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);
|
|
175
1374
|
*/
|
|
176
1375
|
Add(rowData: any[]): string;
|
|
177
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
|
+
*
|
|
178
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");
|
|
179
1389
|
*/
|
|
180
1390
|
Lookup(searchFieldNames: any[], searchValues: any[], limit?: number, orderByFieldName?: string): object[];
|
|
181
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
|
+
*
|
|
182
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"]);
|
|
183
1402
|
*/
|
|
184
1403
|
Remove(columnNames: any[], columnValues: any[]): number;
|
|
185
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
|
+
*
|
|
186
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);
|
|
187
1416
|
*/
|
|
188
1417
|
Retrieve(filter?: object): object[];
|
|
189
1418
|
/**
|
|
1419
|
+
* Updates the columns of rows where `whereFieldNames` equal `whereValues` (AND-joined). Throws if no row matches.
|
|
1420
|
+
*
|
|
190
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"]);
|
|
191
1431
|
*/
|
|
192
1432
|
Update(rowData: object, whereFieldNames: any[], whereValues: any[]): string;
|
|
193
1433
|
}
|
|
194
1434
|
interface DataExtensionInstance {
|
|
195
|
-
Fields:
|
|
196
|
-
Rows:
|
|
1435
|
+
Fields: DataExtensionFields;
|
|
1436
|
+
Rows: DataExtensionRows;
|
|
197
1437
|
}
|
|
198
1438
|
|
|
199
1439
|
// ── Core Library namespaces ──────────────────────────────────────────────────
|
|
200
1440
|
declare namespace Account {
|
|
201
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
|
+
*
|
|
202
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");
|
|
203
1452
|
*/
|
|
204
1453
|
function Init(key: string): any;
|
|
205
1454
|
/**
|
|
1455
|
+
* Retrieves accounts based on the specified filter criteria.
|
|
1456
|
+
*
|
|
1457
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/account/)
|
|
1458
|
+
*
|
|
206
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"});
|
|
207
1465
|
*/
|
|
208
1466
|
function Retrieve(filter: object): object[];
|
|
209
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
|
+
*
|
|
210
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" });
|
|
211
1479
|
*/
|
|
212
1480
|
function Update(properties: object): string;
|
|
213
1481
|
}
|
|
214
1482
|
declare namespace Account.Tracking {
|
|
215
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
|
+
*
|
|
216
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"});
|
|
217
1494
|
*/
|
|
218
1495
|
function Retrieve(filter: object): object[];
|
|
219
1496
|
}
|
|
220
1497
|
declare namespace AccountUser {
|
|
221
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
|
+
*
|
|
222
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);
|
|
223
1510
|
*/
|
|
224
1511
|
function Init(targetUserKey: string, myClientID: number): any;
|
|
225
1512
|
/**
|
|
226
|
-
*
|
|
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);
|
|
227
1532
|
*/
|
|
228
1533
|
function Add(properties: object): string;
|
|
229
1534
|
/**
|
|
1535
|
+
* Retrieves account users based on the specified filter criteria.
|
|
1536
|
+
*
|
|
1537
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/accountuser/)
|
|
1538
|
+
*
|
|
230
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"});
|
|
231
1545
|
*/
|
|
232
1546
|
function Retrieve(filter: object): object[];
|
|
233
1547
|
/**
|
|
1548
|
+
* Updates the account user with the supplied attributes.
|
|
1549
|
+
*
|
|
1550
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/accountuser/)
|
|
1551
|
+
*
|
|
234
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" });
|
|
235
1559
|
*/
|
|
236
1560
|
function Update(properties: object): string;
|
|
237
1561
|
/**
|
|
1562
|
+
* Activates the account user.
|
|
1563
|
+
*
|
|
1564
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/accountuser/)
|
|
1565
|
+
*
|
|
238
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();
|
|
239
1572
|
*/
|
|
240
1573
|
function Activate(): string;
|
|
241
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
|
+
*
|
|
242
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();
|
|
243
1585
|
*/
|
|
244
1586
|
function Deactivate(): string;
|
|
245
1587
|
}
|
|
246
1588
|
declare namespace Portfolio {
|
|
247
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
|
+
*
|
|
248
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");
|
|
249
1600
|
*/
|
|
250
1601
|
function Init(key: string): any;
|
|
251
1602
|
/**
|
|
252
|
-
*
|
|
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);
|
|
253
1620
|
*/
|
|
254
1621
|
function Add(properties: object): string;
|
|
255
1622
|
/**
|
|
1623
|
+
* Returns an array of portfolio objects matching the specified filter.
|
|
1624
|
+
*
|
|
1625
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/portfolio/)
|
|
1626
|
+
*
|
|
256
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" });
|
|
257
1633
|
*/
|
|
258
1634
|
function Retrieve(filter: object): object[];
|
|
259
1635
|
/**
|
|
1636
|
+
* Updates the portfolio object with the supplied attributes.
|
|
1637
|
+
*
|
|
1638
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/portfolio/)
|
|
1639
|
+
*
|
|
260
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" });
|
|
261
1647
|
*/
|
|
262
1648
|
function Update(properties: object): string;
|
|
263
1649
|
/**
|
|
1650
|
+
* Removes the previously initialized portfolio object.
|
|
1651
|
+
*
|
|
1652
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/portfolio/)
|
|
1653
|
+
*
|
|
264
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();
|
|
265
1660
|
*/
|
|
266
1661
|
function Remove(): string;
|
|
267
1662
|
}
|
|
268
1663
|
declare namespace ContentAreaObj {
|
|
269
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
|
+
*
|
|
270
1669
|
* @deprecated
|
|
271
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");
|
|
272
1676
|
*/
|
|
273
1677
|
function Init(key: string): any;
|
|
274
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
|
+
*
|
|
275
1683
|
* @deprecated
|
|
276
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);
|
|
277
1698
|
*/
|
|
278
1699
|
function Add(properties: object): string;
|
|
279
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
|
+
*
|
|
280
1705
|
* @deprecated
|
|
281
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" });
|
|
282
1712
|
*/
|
|
283
1713
|
function Retrieve(filter: object): object[];
|
|
284
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
|
+
*
|
|
285
1719
|
* @deprecated
|
|
286
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" });
|
|
287
1727
|
*/
|
|
288
1728
|
function Update(properties: object): string;
|
|
289
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
|
+
*
|
|
290
1734
|
* @deprecated
|
|
291
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();
|
|
292
1741
|
*/
|
|
293
1742
|
function Remove(): string;
|
|
294
1743
|
}
|
|
295
1744
|
declare namespace Folder {
|
|
296
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
|
+
*
|
|
297
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);
|
|
298
1759
|
*/
|
|
299
1760
|
function Init(key?: string): any;
|
|
300
1761
|
/**
|
|
301
|
-
*
|
|
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);
|
|
302
1782
|
*/
|
|
303
1783
|
function Add(properties: object): string;
|
|
304
1784
|
/**
|
|
305
|
-
*
|
|
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));
|
|
306
1800
|
*/
|
|
307
1801
|
function Retrieve(filter: object): object[];
|
|
308
1802
|
/**
|
|
1803
|
+
* Updates the folder with the supplied attributes.
|
|
1804
|
+
*
|
|
1805
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/folder/)
|
|
1806
|
+
*
|
|
309
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" });
|
|
310
1814
|
*/
|
|
311
1815
|
function Update(properties: object): string;
|
|
312
1816
|
/**
|
|
1817
|
+
* Removes the previously initialized folder.
|
|
1818
|
+
*
|
|
1819
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/folder/)
|
|
1820
|
+
*
|
|
313
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();
|
|
314
1827
|
*/
|
|
315
1828
|
function Remove(): string;
|
|
316
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
|
+
*
|
|
317
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);
|
|
318
1841
|
*/
|
|
319
1842
|
function SetID(id: number): void;
|
|
320
1843
|
}
|
|
321
1844
|
declare namespace Template {
|
|
322
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
|
+
*
|
|
323
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");
|
|
324
1856
|
*/
|
|
325
1857
|
function Init(key: string): any;
|
|
326
1858
|
/**
|
|
327
|
-
*
|
|
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);
|
|
328
1874
|
*/
|
|
329
1875
|
function Add(properties: object): string;
|
|
330
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
|
+
*
|
|
331
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" });
|
|
332
1887
|
*/
|
|
333
1888
|
function Retrieve(filter: object): object[];
|
|
334
1889
|
/**
|
|
1890
|
+
* Updates the template with the supplied attributes.
|
|
1891
|
+
*
|
|
1892
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/template/)
|
|
1893
|
+
*
|
|
335
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" });
|
|
336
1901
|
*/
|
|
337
1902
|
function Update(properties: object): string;
|
|
338
1903
|
}
|
|
339
1904
|
declare namespace DeliveryProfile {
|
|
340
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
|
+
*
|
|
341
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");
|
|
342
1916
|
*/
|
|
343
1917
|
function Init(key: string): any;
|
|
344
1918
|
/**
|
|
345
|
-
*
|
|
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);
|
|
346
1935
|
*/
|
|
347
1936
|
function Add(properties: object): string;
|
|
348
1937
|
/**
|
|
1938
|
+
* Updates the delivery profile with the supplied attributes.
|
|
1939
|
+
*
|
|
1940
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/deliveryprofile/)
|
|
1941
|
+
*
|
|
349
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" });
|
|
350
1949
|
*/
|
|
351
1950
|
function Update(properties: object): string;
|
|
352
1951
|
/**
|
|
1952
|
+
* Removes the previously initialized delivery profile.
|
|
1953
|
+
*
|
|
1954
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/deliveryprofile/)
|
|
1955
|
+
*
|
|
353
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();
|
|
354
1962
|
*/
|
|
355
1963
|
function Remove(): string;
|
|
356
1964
|
}
|
|
357
1965
|
declare namespace SenderProfile {
|
|
358
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
|
+
*
|
|
359
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");
|
|
360
1977
|
*/
|
|
361
1978
|
function Init(key: string): any;
|
|
362
1979
|
/**
|
|
363
|
-
*
|
|
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);
|
|
364
1997
|
*/
|
|
365
1998
|
function Add(properties: object): string;
|
|
366
1999
|
/**
|
|
2000
|
+
* Updates the sender profile with the supplied attributes.
|
|
2001
|
+
*
|
|
2002
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senderprofile/)
|
|
2003
|
+
*
|
|
367
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" });
|
|
368
2011
|
*/
|
|
369
2012
|
function Update(properties: object): string;
|
|
370
2013
|
/**
|
|
2014
|
+
* Removes the previously initialized sender profile.
|
|
2015
|
+
*
|
|
2016
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senderprofile/)
|
|
2017
|
+
*
|
|
371
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();
|
|
372
2024
|
*/
|
|
373
2025
|
function Remove(): string;
|
|
374
2026
|
}
|
|
375
2027
|
declare namespace SendClassification {
|
|
376
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
|
+
*
|
|
377
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");
|
|
378
2039
|
*/
|
|
379
2040
|
function Init(key: string): any;
|
|
380
2041
|
/**
|
|
381
|
-
*
|
|
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);
|
|
382
2059
|
*/
|
|
383
2060
|
function Add(properties: object): string;
|
|
384
2061
|
/**
|
|
2062
|
+
* Returns an array of send classifications matching the specified filter.
|
|
2063
|
+
*
|
|
2064
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/sendclassification/)
|
|
2065
|
+
*
|
|
385
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" });
|
|
386
2072
|
*/
|
|
387
2073
|
function Retrieve(filter: object): object[];
|
|
388
2074
|
/**
|
|
389
|
-
*
|
|
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);
|
|
390
2091
|
*/
|
|
391
2092
|
function Update(properties: object): string;
|
|
392
2093
|
/**
|
|
2094
|
+
* Removes the previously initialized send classification.
|
|
2095
|
+
*
|
|
2096
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/sendclassification/)
|
|
2097
|
+
*
|
|
393
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();
|
|
394
2104
|
*/
|
|
395
2105
|
function Remove(): string;
|
|
396
2106
|
}
|
|
397
2107
|
declare namespace FilterDefinition {
|
|
398
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
|
+
*
|
|
399
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");
|
|
400
2119
|
*/
|
|
401
2120
|
function Init(key: string): any;
|
|
402
2121
|
/**
|
|
403
|
-
*
|
|
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);
|
|
404
2139
|
*/
|
|
405
2140
|
function Add(properties: object): string;
|
|
406
2141
|
/**
|
|
2142
|
+
* Returns an array of filter definitions matching the specified filter.
|
|
2143
|
+
*
|
|
2144
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/filterdefinition/)
|
|
2145
|
+
*
|
|
407
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" });
|
|
408
2152
|
*/
|
|
409
2153
|
function Retrieve(filter: object): object[];
|
|
410
2154
|
/**
|
|
2155
|
+
* Updates the filter definition with the supplied attributes.
|
|
2156
|
+
*
|
|
2157
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/filterdefinition/)
|
|
2158
|
+
*
|
|
411
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" });
|
|
412
2166
|
*/
|
|
413
2167
|
function Update(properties: object): string;
|
|
414
2168
|
/**
|
|
2169
|
+
* Deletes the previously initialized filter definition.
|
|
2170
|
+
*
|
|
2171
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/filterdefinition/)
|
|
2172
|
+
*
|
|
415
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();
|
|
416
2179
|
*/
|
|
417
2180
|
function Remove(): string;
|
|
418
2181
|
}
|
|
419
2182
|
declare namespace QueryDefinition {
|
|
420
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
|
+
*
|
|
421
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");
|
|
422
2194
|
*/
|
|
423
2195
|
function Init(key: string): any;
|
|
424
2196
|
/**
|
|
425
|
-
*
|
|
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);
|
|
426
2215
|
*/
|
|
427
2216
|
function Add(properties: object): string;
|
|
428
2217
|
/**
|
|
429
|
-
*
|
|
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));
|
|
430
2233
|
*/
|
|
431
2234
|
function Retrieve(filter: object): object[];
|
|
432
2235
|
/**
|
|
433
|
-
*
|
|
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
|
+
* });
|
|
434
2250
|
*/
|
|
435
2251
|
function Update(properties: object): string;
|
|
436
2252
|
/**
|
|
2253
|
+
* Removes the previously initialized query definition.
|
|
2254
|
+
*
|
|
2255
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/querydefinition/)
|
|
2256
|
+
*
|
|
437
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();
|
|
438
2263
|
*/
|
|
439
2264
|
function Remove(): string;
|
|
440
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
|
+
*
|
|
441
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));
|
|
442
2278
|
*/
|
|
443
2279
|
function Perform(action: string): string;
|
|
444
2280
|
}
|
|
445
2281
|
declare namespace List {
|
|
446
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
|
+
*
|
|
447
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");
|
|
448
2293
|
*/
|
|
449
2294
|
function Init(key: string): any;
|
|
450
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
|
+
*
|
|
451
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" });
|
|
452
2306
|
*/
|
|
453
2307
|
function Add(properties: object): any;
|
|
454
2308
|
/**
|
|
2309
|
+
* Returns an array of lists matching the specified filter.
|
|
2310
|
+
*
|
|
2311
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list/)
|
|
2312
|
+
*
|
|
455
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" });
|
|
456
2319
|
*/
|
|
457
2320
|
function Retrieve(filter: object): object[];
|
|
458
2321
|
/**
|
|
2322
|
+
* Removes the previously initialized list.
|
|
2323
|
+
*
|
|
2324
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list/)
|
|
2325
|
+
*
|
|
459
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();
|
|
460
2332
|
*/
|
|
461
2333
|
function Remove(): string;
|
|
462
2334
|
}
|
|
463
2335
|
declare namespace List.Subscribers {
|
|
464
2336
|
/**
|
|
465
|
-
*
|
|
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));
|
|
466
2352
|
*/
|
|
467
2353
|
function Add(properties: object): string;
|
|
468
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
|
+
*
|
|
469
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();
|
|
470
2366
|
*/
|
|
471
2367
|
function Retrieve(filter?: object): object[];
|
|
472
2368
|
/**
|
|
2369
|
+
* Removes the specified subscriber from the previously initialized list.
|
|
2370
|
+
*
|
|
2371
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/list-subscribers/)
|
|
2372
|
+
*
|
|
473
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");
|
|
474
2380
|
*/
|
|
475
2381
|
function Unsubscribe(emailAddress: string): string;
|
|
476
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
|
+
*
|
|
477
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");
|
|
478
2395
|
*/
|
|
479
2396
|
function Update(emailAddress: string, status: string): string;
|
|
480
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
|
+
*
|
|
481
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" });
|
|
482
2410
|
*/
|
|
483
2411
|
function Upsert(emailAddress: string, attributes: object): string;
|
|
484
2412
|
}
|
|
485
2413
|
declare namespace List.Subscribers.Tracking {
|
|
486
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
|
+
*
|
|
487
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" });
|
|
488
2426
|
*/
|
|
489
2427
|
function Retrieve(filter: object): object[];
|
|
490
2428
|
}
|
|
491
2429
|
declare namespace Subscriber {
|
|
492
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
|
+
*
|
|
493
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");
|
|
494
2441
|
*/
|
|
495
2442
|
function Init(key: string): any;
|
|
496
2443
|
/**
|
|
497
|
-
*
|
|
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);
|
|
498
2461
|
*/
|
|
499
2462
|
function Add(properties: object): string;
|
|
500
2463
|
/**
|
|
2464
|
+
* Returns an array of subscribers matching the specified filter.
|
|
2465
|
+
*
|
|
2466
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2467
|
+
*
|
|
501
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" });
|
|
502
2474
|
*/
|
|
503
2475
|
function Retrieve(filter: object): object[];
|
|
504
2476
|
/**
|
|
505
|
-
*
|
|
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));
|
|
506
2493
|
*/
|
|
507
2494
|
function Upsert(properties: object): string;
|
|
508
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
|
+
*
|
|
509
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));
|
|
510
2507
|
*/
|
|
511
2508
|
function Statistics(subscriberKey: string): object;
|
|
512
2509
|
/**
|
|
2510
|
+
* Updates the previously initialized subscriber with the supplied attributes.
|
|
2511
|
+
*
|
|
2512
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2513
|
+
*
|
|
513
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" } });
|
|
514
2521
|
*/
|
|
515
2522
|
function Update(properties: object): string;
|
|
516
2523
|
/**
|
|
2524
|
+
* Deletes the previously initialized subscriber.
|
|
2525
|
+
*
|
|
2526
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2527
|
+
*
|
|
517
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();
|
|
518
2534
|
*/
|
|
519
2535
|
function Remove(): string;
|
|
520
2536
|
/**
|
|
2537
|
+
* Sets the previously initialized subscriber's status to `"Unsubscribed"`.
|
|
2538
|
+
*
|
|
2539
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/subscriber/)
|
|
2540
|
+
*
|
|
521
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();
|
|
522
2547
|
*/
|
|
523
2548
|
function Unsubscribe(): string;
|
|
524
2549
|
}
|
|
525
2550
|
declare namespace Subscriber.Attributes {
|
|
526
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
|
+
*
|
|
527
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();
|
|
528
2562
|
*/
|
|
529
2563
|
function Retrieve(): object[];
|
|
530
2564
|
}
|
|
531
2565
|
declare namespace Subscriber.Lists {
|
|
532
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
|
+
*
|
|
533
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();
|
|
534
2577
|
*/
|
|
535
2578
|
function Retrieve(): object[];
|
|
536
2579
|
}
|
|
537
2580
|
declare namespace Email {
|
|
538
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
|
+
*
|
|
539
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");
|
|
540
2592
|
*/
|
|
541
2593
|
function Init(key: string): any;
|
|
542
2594
|
/**
|
|
543
|
-
*
|
|
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);
|
|
544
2614
|
*/
|
|
545
2615
|
function Add(properties: object): any;
|
|
546
2616
|
/**
|
|
2617
|
+
* Returns an array of email messages matching the specified filter.
|
|
2618
|
+
*
|
|
2619
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2620
|
+
*
|
|
547
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" });
|
|
548
2627
|
*/
|
|
549
2628
|
function Retrieve(filter: object): object[];
|
|
550
2629
|
/**
|
|
2630
|
+
* Updates the email message with the supplied attributes.
|
|
2631
|
+
*
|
|
2632
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2633
|
+
*
|
|
551
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" });
|
|
552
2641
|
*/
|
|
553
2642
|
function Update(properties: object): string;
|
|
554
2643
|
/**
|
|
2644
|
+
* Removes the previously initialized email message.
|
|
2645
|
+
*
|
|
2646
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/email/)
|
|
2647
|
+
*
|
|
555
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();
|
|
556
2654
|
*/
|
|
557
2655
|
function Remove(): string;
|
|
558
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
|
+
*
|
|
559
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);
|
|
560
2669
|
*/
|
|
561
2670
|
function Validate(): object;
|
|
562
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
|
+
*
|
|
563
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);
|
|
564
2684
|
*/
|
|
565
2685
|
function CheckContent(): object;
|
|
566
2686
|
}
|
|
567
2687
|
declare namespace Send {
|
|
568
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
|
+
*
|
|
569
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);
|
|
570
2699
|
*/
|
|
571
2700
|
function Init(id: number): any;
|
|
572
2701
|
/**
|
|
573
|
-
*
|
|
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);
|
|
574
2716
|
*/
|
|
575
2717
|
function Add(emailKey: string, listIds: any[], options?: object): string;
|
|
576
2718
|
/**
|
|
2719
|
+
* Returns an array of sends matching the specified filter.
|
|
2720
|
+
*
|
|
2721
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2722
|
+
*
|
|
577
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 });
|
|
578
2729
|
*/
|
|
579
2730
|
function Retrieve(filter: object): object[];
|
|
580
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
|
+
*
|
|
581
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 });
|
|
582
2742
|
*/
|
|
583
2743
|
function RetrieveLists(filter: object): object[];
|
|
584
2744
|
/**
|
|
2745
|
+
* Removes the previously initialized send.
|
|
2746
|
+
*
|
|
2747
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2748
|
+
*
|
|
585
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();
|
|
586
2755
|
*/
|
|
587
2756
|
function Remove(): string;
|
|
588
2757
|
/**
|
|
2758
|
+
* Attempts to cancel the previously initialized send.
|
|
2759
|
+
*
|
|
2760
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2761
|
+
*
|
|
589
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();
|
|
590
2768
|
*/
|
|
591
2769
|
function CancelSend(): string;
|
|
592
2770
|
}
|
|
593
2771
|
declare namespace Send.Tracking {
|
|
594
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
|
+
*
|
|
595
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 });
|
|
596
2783
|
*/
|
|
597
2784
|
function Retrieve(filter: object): object[];
|
|
598
2785
|
/**
|
|
2786
|
+
* Returns click tracking data for the previously initialized send.
|
|
2787
|
+
*
|
|
2788
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/send/)
|
|
2789
|
+
*
|
|
599
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 });
|
|
600
2797
|
*/
|
|
601
2798
|
function ClickRetrieve(filter: object): object[];
|
|
602
2799
|
/**
|
|
603
|
-
*
|
|
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");
|
|
604
2814
|
*/
|
|
605
2815
|
function TotalByIntervalRetrieve(type: string, startDate: string, endDate: string, groupBy: string): object[];
|
|
606
2816
|
}
|
|
607
2817
|
declare namespace Send.Definition {
|
|
608
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
|
+
*
|
|
609
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");
|
|
610
2829
|
*/
|
|
611
2830
|
function Init(key: string): any;
|
|
612
2831
|
/**
|
|
613
|
-
*
|
|
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]);
|
|
614
2846
|
*/
|
|
615
2847
|
function Add(esdParams: object, sendClassificationKey: string, emailKey: string, listIds: any[]): string;
|
|
616
2848
|
/**
|
|
617
|
-
*
|
|
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");
|
|
618
2864
|
*/
|
|
619
2865
|
function AddWithDE(esdParams: object, sendClassificationKey: string, emailKey: string, sendableDataExtensionKey: string, publicationListKey: string): string;
|
|
620
2866
|
/**
|
|
621
|
-
*
|
|
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);
|
|
622
2882
|
*/
|
|
623
2883
|
function AddWithFilterDefinition(esdParams: object, sendClassificationKey: string, emailKey: string, filterDefinitionKey: string, listId: number): string;
|
|
624
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
|
+
*
|
|
625
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" });
|
|
626
2895
|
*/
|
|
627
2896
|
function Retrieve(filter?: object): object[];
|
|
628
2897
|
/**
|
|
2898
|
+
* Updates the previously initialized send definition.
|
|
2899
|
+
*
|
|
2900
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2901
|
+
*
|
|
629
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" });
|
|
630
2909
|
*/
|
|
631
2910
|
function Update(properties: object): string;
|
|
632
2911
|
/**
|
|
2912
|
+
* Deletes the previously initialized send definition.
|
|
2913
|
+
*
|
|
2914
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/senddefinition/)
|
|
2915
|
+
*
|
|
633
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();
|
|
634
2922
|
*/
|
|
635
2923
|
function Remove(): string;
|
|
636
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
|
+
*
|
|
637
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();
|
|
638
2935
|
*/
|
|
639
2936
|
function Send(): string;
|
|
640
2937
|
}
|
|
641
2938
|
declare namespace TriggeredSend {
|
|
642
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
|
+
*
|
|
643
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");
|
|
644
2950
|
*/
|
|
645
2951
|
function Init(key: string): any;
|
|
646
2952
|
/**
|
|
647
|
-
*
|
|
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);
|
|
648
2971
|
*/
|
|
649
2972
|
function Add(properties: object): any;
|
|
650
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
|
+
*
|
|
651
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" });
|
|
652
2984
|
*/
|
|
653
2985
|
function Retrieve(filter: object): object[];
|
|
654
2986
|
/**
|
|
2987
|
+
* Updates the previously initialized triggered send definition.
|
|
2988
|
+
*
|
|
2989
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
2990
|
+
*
|
|
655
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" });
|
|
656
2998
|
*/
|
|
657
2999
|
function Update(properties: object): string;
|
|
658
3000
|
/**
|
|
3001
|
+
* Starts (reactivates) a paused triggered send definition.
|
|
3002
|
+
*
|
|
3003
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3004
|
+
*
|
|
659
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();
|
|
660
3011
|
*/
|
|
661
3012
|
function Start(): string;
|
|
662
3013
|
/**
|
|
3014
|
+
* Pauses an active triggered send definition.
|
|
3015
|
+
*
|
|
3016
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3017
|
+
*
|
|
663
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();
|
|
664
3024
|
*/
|
|
665
3025
|
function Pause(): string;
|
|
666
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
|
+
*
|
|
667
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();
|
|
668
3037
|
*/
|
|
669
3038
|
function Publish(): string;
|
|
670
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
|
+
*
|
|
671
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; }
|
|
672
3053
|
*/
|
|
673
3054
|
function Send(emailAddress: string, sendTimeAttributes?: object): string;
|
|
674
3055
|
}
|
|
675
3056
|
declare namespace TriggeredSend.Tracking {
|
|
676
3057
|
/**
|
|
3058
|
+
* Returns tracking data for the previously initialized triggered send definition.
|
|
3059
|
+
*
|
|
3060
|
+
* [ssjs.guide reference](https://ssjs.guide/core-library/triggeredsend/)
|
|
3061
|
+
*
|
|
677
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();
|
|
678
3069
|
*/
|
|
679
3070
|
function Retrieve(filter?: object): object[];
|
|
680
3071
|
}
|
|
681
3072
|
declare namespace TriggeredSend.Tracking.Clicks {
|
|
682
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
|
+
*
|
|
683
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 });
|
|
684
3085
|
*/
|
|
685
3086
|
function Retrieve(filter: object): object[];
|
|
686
3087
|
}
|
|
687
3088
|
declare namespace TriggeredSend.Tracking.TotalByInterval {
|
|
688
3089
|
/**
|
|
689
|
-
*
|
|
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");
|
|
690
3104
|
*/
|
|
691
3105
|
function Retrieve(type: string, startDate: string, endDate: string, groupBy: string): object[];
|
|
692
3106
|
}
|
|
693
3107
|
declare namespace DataExtension {
|
|
694
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
|
+
*
|
|
695
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");
|
|
696
3119
|
*/
|
|
697
3120
|
function Init(key: string): DataExtensionInstance;
|
|
698
3121
|
/**
|
|
699
|
-
*
|
|
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);
|
|
700
3144
|
*/
|
|
701
3145
|
function Add(properties: object): DataExtensionInstance;
|
|
702
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
|
+
*
|
|
703
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" });
|
|
704
3158
|
*/
|
|
705
3159
|
function Retrieve(filter: object, queryAllAccounts?: boolean): object[];
|
|
706
3160
|
}
|
|
707
3161
|
declare namespace DataExtension.Fields {
|
|
708
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
|
+
*
|
|
709
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);
|
|
710
3175
|
*/
|
|
711
3176
|
function Add(properties: object): string;
|
|
712
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
|
+
*
|
|
713
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();
|
|
714
3188
|
*/
|
|
715
3189
|
function Retrieve(): object[];
|
|
716
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
|
+
*
|
|
717
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");
|
|
718
3203
|
*/
|
|
719
3204
|
function UpdateSendableField(deFieldName: string, subscriberField: string): string;
|
|
720
3205
|
}
|
|
721
3206
|
declare namespace DataExtension.Rows {
|
|
722
3207
|
/**
|
|
723
|
-
*
|
|
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);
|
|
724
3223
|
*/
|
|
725
3224
|
function Add(rowData: any[]): string;
|
|
726
3225
|
/**
|
|
727
|
-
*
|
|
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");
|
|
728
3240
|
*/
|
|
729
3241
|
function Lookup(searchFieldNames: any[], searchValues: any[], limit?: number, orderByFieldName?: string): object[];
|
|
730
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
|
+
*
|
|
731
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"]);
|
|
732
3255
|
*/
|
|
733
3256
|
function Remove(columnNames: any[], columnValues: any[]): number;
|
|
734
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
|
+
*
|
|
735
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);
|
|
736
3271
|
*/
|
|
737
3272
|
function Retrieve(filter?: object): object[];
|
|
738
3273
|
/**
|
|
739
|
-
*
|
|
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"]);
|
|
740
3288
|
*/
|
|
741
3289
|
function Update(rowData: object, whereFieldNames: any[], whereValues: any[]): string;
|
|
742
3290
|
}
|
|
743
3291
|
declare namespace DateTime.TimeZone {
|
|
744
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
|
+
*
|
|
745
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));
|
|
746
3303
|
*/
|
|
747
3304
|
function Retrieve(filter: object): object[];
|
|
748
3305
|
}
|
|
@@ -750,14 +3307,42 @@ declare namespace DateTime.TimeZone {
|
|
|
750
3307
|
// ── Standalone Core Library globals ──────────────────────────────────────────
|
|
751
3308
|
declare namespace Attribute {
|
|
752
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
|
+
*
|
|
753
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);
|
|
754
3320
|
*/
|
|
755
3321
|
function GetValue(name: string): string;
|
|
756
3322
|
}
|
|
757
3323
|
|
|
758
3324
|
declare namespace ErrorUtil {
|
|
759
3325
|
/**
|
|
760
|
-
*
|
|
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
|
+
* }
|
|
761
3346
|
*/
|
|
762
3347
|
function ThrowWSProxyError(result: object): void;
|
|
763
3348
|
}
|
|
@@ -765,55 +3350,118 @@ declare namespace ErrorUtil {
|
|
|
765
3350
|
// ── Event namespaces ─────────────────────────────────────────────────────────
|
|
766
3351
|
declare namespace BounceEvent {
|
|
767
3352
|
/**
|
|
3353
|
+
* Retrieves bounce event data for message sends matching the specified filter.
|
|
3354
|
+
*
|
|
768
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));
|
|
769
3361
|
*/
|
|
770
3362
|
function Retrieve(filter: object): object[];
|
|
771
3363
|
}
|
|
772
3364
|
declare namespace ClickEvent {
|
|
773
3365
|
/**
|
|
3366
|
+
* Retrieves click tracking event data for message sends matching the specified filter.
|
|
3367
|
+
*
|
|
774
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));
|
|
775
3374
|
*/
|
|
776
3375
|
function Retrieve(filter: object): object[];
|
|
777
3376
|
}
|
|
778
3377
|
declare namespace ForwardedEmailEvent {
|
|
779
3378
|
/**
|
|
3379
|
+
* Retrieves forwarded email event data for message sends matching the specified filter.
|
|
3380
|
+
*
|
|
780
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));
|
|
781
3387
|
*/
|
|
782
3388
|
function Retrieve(filter: object): object[];
|
|
783
3389
|
}
|
|
784
3390
|
declare namespace ForwardedEmailOptInEvent {
|
|
785
3391
|
/**
|
|
3392
|
+
* Retrieves forwarded email opt-in event data for message sends matching the specified filter.
|
|
3393
|
+
*
|
|
786
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));
|
|
787
3400
|
*/
|
|
788
3401
|
function Retrieve(filter: object): object[];
|
|
789
3402
|
}
|
|
790
3403
|
declare namespace NotSentEvent {
|
|
791
3404
|
/**
|
|
3405
|
+
* Retrieves not-sent event data for message sends matching the specified filter.
|
|
3406
|
+
*
|
|
792
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));
|
|
793
3413
|
*/
|
|
794
3414
|
function Retrieve(filter: object): object[];
|
|
795
3415
|
}
|
|
796
3416
|
declare namespace OpenEvent {
|
|
797
3417
|
/**
|
|
3418
|
+
* Retrieves open tracking event data for message sends matching the specified filter.
|
|
3419
|
+
*
|
|
798
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));
|
|
799
3426
|
*/
|
|
800
3427
|
function Retrieve(filter: object): object[];
|
|
801
3428
|
}
|
|
802
3429
|
declare namespace SentEvent {
|
|
803
3430
|
/**
|
|
3431
|
+
* Retrieves sent event data for message sends matching the specified filter.
|
|
3432
|
+
*
|
|
804
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));
|
|
805
3439
|
*/
|
|
806
3440
|
function Retrieve(filter: object): object[];
|
|
807
3441
|
}
|
|
808
3442
|
declare namespace SurveyEvent {
|
|
809
3443
|
/**
|
|
3444
|
+
* Retrieves survey response event data for message sends matching the specified filter.
|
|
3445
|
+
*
|
|
810
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));
|
|
811
3452
|
*/
|
|
812
3453
|
function Retrieve(filter: object): object[];
|
|
813
3454
|
}
|
|
814
3455
|
declare namespace UnsubEvent {
|
|
815
3456
|
/**
|
|
3457
|
+
* Retrieves unsubscribe event data for message sends matching the specified filter.
|
|
3458
|
+
*
|
|
816
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));
|
|
817
3465
|
*/
|
|
818
3466
|
function Retrieve(filter: object): object[];
|
|
819
3467
|
}
|
|
@@ -821,26 +3469,76 @@ declare namespace UnsubEvent {
|
|
|
821
3469
|
// ── HTTP / HTTPHeader ────────────────────────────────────────────────────────
|
|
822
3470
|
declare namespace HTTP {
|
|
823
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
|
+
*
|
|
824
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));
|
|
825
3484
|
*/
|
|
826
3485
|
function Get(url: string, headerNames?: any[], headerValues?: any[]): object;
|
|
827
3486
|
/**
|
|
828
|
-
*
|
|
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);
|
|
829
3501
|
*/
|
|
830
3502
|
function Post(url: string, contentType: string, payload: string, headerNames: string[], headerValues: any[]): object;
|
|
831
3503
|
}
|
|
832
3504
|
|
|
833
3505
|
declare namespace HTTPHeader {
|
|
834
3506
|
/**
|
|
3507
|
+
* Retrieves the value of the specified HTTP request header.
|
|
3508
|
+
*
|
|
3509
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/httpheader/)
|
|
3510
|
+
*
|
|
835
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);
|
|
836
3517
|
*/
|
|
837
3518
|
function GetValue(name: string): string;
|
|
838
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
|
+
*
|
|
839
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");
|
|
840
3530
|
*/
|
|
841
3531
|
function SetValue(name: string, value: string): void;
|
|
842
3532
|
/**
|
|
3533
|
+
* Removes the specified entry from the HTTP header.
|
|
3534
|
+
*
|
|
3535
|
+
* [ssjs.guide reference](https://ssjs.guide/platform-objects/httpheader/)
|
|
3536
|
+
*
|
|
843
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"
|
|
844
3542
|
*/
|
|
845
3543
|
function Remove(headerName: string): string;
|
|
846
3544
|
}
|
|
@@ -850,34 +3548,368 @@ declare namespace Script {
|
|
|
850
3548
|
namespace Util {
|
|
851
3549
|
class WSProxy {
|
|
852
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
|
+
*/
|
|
853
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
|
+
*/
|
|
854
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
|
+
*/
|
|
855
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
|
+
*/
|
|
856
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
|
+
*/
|
|
857
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
|
+
*/
|
|
858
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
|
+
*/
|
|
859
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
|
+
*/
|
|
860
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
|
+
*/
|
|
861
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
|
+
*/
|
|
862
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
|
+
*/
|
|
863
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
|
+
*/
|
|
864
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
|
+
*/
|
|
865
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
|
+
*/
|
|
866
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
|
+
*/
|
|
867
3797
|
deleteBatch(objectType: string, propertiesArray: any[]): object;
|
|
868
3798
|
}
|
|
869
3799
|
class HttpRequest {
|
|
870
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
|
+
*/
|
|
871
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
|
+
*/
|
|
872
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
|
+
*/
|
|
873
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
|
+
*/
|
|
874
3855
|
removeHeader(name: string): void;
|
|
875
3856
|
}
|
|
876
3857
|
class HttpGet {
|
|
877
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
|
+
*/
|
|
878
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
|
+
*/
|
|
879
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
|
+
*/
|
|
880
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
|
+
*/
|
|
881
3913
|
removeHeader(name: string): void;
|
|
882
3914
|
}
|
|
883
3915
|
}
|
|
@@ -917,12 +3949,45 @@ interface String {
|
|
|
917
3949
|
}
|
|
918
3950
|
|
|
919
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
|
+
*/
|
|
920
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
|
+
*/
|
|
921
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
|
+
*/
|
|
922
3977
|
toPrecision(precision?: number): string;
|
|
923
3978
|
}
|
|
924
3979
|
|
|
925
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
|
+
*/
|
|
926
3991
|
hasOwnProperty(v?: string): boolean;
|
|
927
3992
|
}
|
|
928
3993
|
|