ampscript-data 3.6.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/constants.js +47 -0
- package/src/derived.js +100 -0
- package/src/functions/content.js +1028 -0
- package/src/functions/data-extension.js +1117 -0
- package/src/functions/date-time.js +411 -0
- package/src/functions/einstein-email-recs.js +32 -0
- package/src/functions/encryption-encoding.js +545 -0
- package/src/functions/http.js +338 -0
- package/src/functions/index.js +203 -0
- package/src/functions/marketing-cloud-api.js +378 -0
- package/src/functions/math.js +167 -0
- package/src/functions/microsoft-dynamics.js +400 -0
- package/src/functions/mobileconnect.js +339 -0
- package/src/functions/sales-service-cloud.js +230 -0
- package/src/functions/social.js +151 -0
- package/src/functions/string.js +432 -0
- package/src/functions/utility.js +1118 -0
- package/src/globals.js +9 -0
- package/src/index.js +48 -6865
- package/src/keywords.js +121 -0
- package/src/operators.js +66 -0
- package/src/personalization.js +254 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
// AUTO-SPLIT from the original single-file src/index.js. Data moved verbatim.
|
|
2
|
+
// AMPscript FUNCTIONS — category: MobileConnect (9 entries).
|
|
3
|
+
|
|
4
|
+
import { INF } from '../constants.js';
|
|
5
|
+
|
|
6
|
+
export const MOBILECONNECT_FUNCTIONS = [
|
|
7
|
+
{
|
|
8
|
+
name: 'CreateSmsConversation',
|
|
9
|
+
supportedInCloudPage: true,
|
|
10
|
+
supportedInEmail: true,
|
|
11
|
+
mcnSince: null,
|
|
12
|
+
handlebarsEquivalent: null,
|
|
13
|
+
mcnNotes: null,
|
|
14
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-create-sms-conversation.html',
|
|
15
|
+
guideUrl: 'https://ampscript.guide/createsmsconversation/',
|
|
16
|
+
minArgs: 4,
|
|
17
|
+
maxArgs: 4,
|
|
18
|
+
category: 'MobileConnect',
|
|
19
|
+
description:
|
|
20
|
+
'Initiates an SMS conversation with a contact from within a MobileConnect message. Returns true when a conversation is created inside a MobileConnect message context, and false in any other context (for example a CloudPage or email). The success path cannot be exercised outside a live MobileConnect send.',
|
|
21
|
+
isConfirmed: true,
|
|
22
|
+
differsFromOfficialDocs: true,
|
|
23
|
+
officialDocsNote:
|
|
24
|
+
"The out-of-context return is confirmed in two independent runtime contexts: a CloudPage on the child BU and an email render on the child BU. Being an ordinary function call (unlike Msg()/Noun()/Verb()), it compiles and evaluates in both: on the CloudPage, called with a real short code, an authorized destination number and app 'MOBILECONNECT', it returned the literal boolean false with the page rendering fully and no SMS sent; in an email body the same call rendered the literal False through the Email Preview API. This confirms the ampscript.guide claim that the function returns false outside a MobileConnect message context; the official Salesforce reference omits this and describes only the in-context behaviour (true on success, exception on failure). The success path (true, real conversation creation) requires a live MobileConnect message context and cannot be reproduced in a CloudPage or email; only the out-of-context false-return is exercisable, and it is proven. The catalogued signature was also corrected here: the four parameters are originationNumber, destinationNumber, nextKeyword and app, and the return is a boolean, not void.",
|
|
25
|
+
params: [
|
|
26
|
+
{
|
|
27
|
+
name: 'originationNumber',
|
|
28
|
+
description: 'The MobileConnect short code or long code used to send',
|
|
29
|
+
type: 'string',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'destinationNumber',
|
|
33
|
+
description: "The contact's phone number, including country code",
|
|
34
|
+
type: 'string',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'nextKeyword',
|
|
38
|
+
description: 'The keyword to set as the next conversation keyword',
|
|
39
|
+
type: 'string',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'app',
|
|
43
|
+
description: "The application for the conversation; must be 'MOBILECONNECT'",
|
|
44
|
+
type: 'string',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
returnType: 'boolean',
|
|
48
|
+
returnDescription:
|
|
49
|
+
'true when a conversation is created inside a MobileConnect message context; false in any other context (proven on a CloudPage). Fails with an exception in-context if unsuccessful.',
|
|
50
|
+
syntax: 'CreateSmsConversation(originationNumber, destinationNumber, nextKeyword, app)',
|
|
51
|
+
example: '%%=CreateSmsConversation("12345", MOBILE_NUMBER, "KEYWORD", "MOBILECONNECT")=%%',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'EndSmsConversation',
|
|
55
|
+
supportedInCloudPage: true,
|
|
56
|
+
supportedInEmail: true,
|
|
57
|
+
mcnSince: null,
|
|
58
|
+
handlebarsEquivalent: null,
|
|
59
|
+
mcnNotes: null,
|
|
60
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-end-sms-conversation.html',
|
|
61
|
+
guideUrl: 'https://ampscript.guide/endsmsconversation/',
|
|
62
|
+
minArgs: 2,
|
|
63
|
+
maxArgs: 2,
|
|
64
|
+
category: 'MobileConnect',
|
|
65
|
+
description:
|
|
66
|
+
'Ends an active SMS conversation with a contact from within a MobileConnect message. Returns true when the conversation is ended inside a MobileConnect message context, and false in any other context (for example a CloudPage or email). The success path cannot be exercised outside a live MobileConnect send.',
|
|
67
|
+
isConfirmed: true,
|
|
68
|
+
differsFromOfficialDocs: true,
|
|
69
|
+
officialDocsNote:
|
|
70
|
+
'The out-of-context return is confirmed in two independent runtime contexts: a CloudPage on the child BU and an email render on the child BU. Being an ordinary function call, it compiles and evaluates in both: on the CloudPage, called with a real short code and the authorized destination number, it returned the literal boolean false with the page rendering fully, no SMS sent and no conversation state changed; in an email body the same call rendered the literal False through the Email Preview API. This confirms the ampscript.guide claim that the function returns false outside a MobileConnect message context; the official Salesforce reference omits this and describes only the in-context behaviour (true on success, exception on failure). The success path (true, real conversation end) requires a live MobileConnect message context and cannot be reproduced in a CloudPage or email; only the out-of-context false-return is exercisable, and it is proven. The catalogued signature was corrected here: the two parameters are originationNumber and destinationNumber, and the return is a boolean, not void.',
|
|
71
|
+
params: [
|
|
72
|
+
{
|
|
73
|
+
name: 'originationNumber',
|
|
74
|
+
description: 'The MobileConnect short code or long code used to send',
|
|
75
|
+
type: 'string',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'destinationNumber',
|
|
79
|
+
description: "The contact's phone number, including country code",
|
|
80
|
+
type: 'string',
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
returnType: 'boolean',
|
|
84
|
+
returnDescription:
|
|
85
|
+
'true when the conversation is ended inside a MobileConnect message context; false in any other context (proven on a CloudPage). Fails with an exception in-context if unsuccessful.',
|
|
86
|
+
syntax: 'EndSmsConversation(originationNumber, destinationNumber)',
|
|
87
|
+
example: '%%=EndSmsConversation("12345", MOBILE_NUMBER)=%%',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'MMS_Content_URL',
|
|
91
|
+
supportedInCloudPage: false,
|
|
92
|
+
supportedInEmail: false,
|
|
93
|
+
mcnSince: null,
|
|
94
|
+
handlebarsEquivalent: null,
|
|
95
|
+
mcnNotes: null,
|
|
96
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-mms-content-url.html',
|
|
97
|
+
guideUrl: 'https://ampscript.guide/mobileconnect-data-strings/',
|
|
98
|
+
minArgs: 1,
|
|
99
|
+
maxArgs: 1,
|
|
100
|
+
category: 'MobileConnect',
|
|
101
|
+
description:
|
|
102
|
+
'Returns the URL of MMS content from an inbound mobile-originated (MO) message. Only usable in MobileConnect.',
|
|
103
|
+
isConfirmed: false,
|
|
104
|
+
verificationBlocked: true,
|
|
105
|
+
verificationBlockedReason: 'no-working-invocation',
|
|
106
|
+
officialDocsNote:
|
|
107
|
+
'Could not runtime-verify on the only available context (a CloudPage GET on the child BU; no parent-BU escalation is configured on this tenant). Including an MMS_Content_URL(0) call in the injected content block aborted the whole page at compile time (HTTP 422) even when the call sat inside a non-matching IF branch, while an otherwise identical page with the call removed rendered HTTP 200. This matches the official reference, which states the function is usable only in MobileConnect and not in landing pages or other content types; there is no mobile-originated message context on a CloudPage to exercise it against.',
|
|
108
|
+
params: [
|
|
109
|
+
{
|
|
110
|
+
name: 'position',
|
|
111
|
+
description:
|
|
112
|
+
'Zero-based index of the MMS content to return; 0 returns the first attachment',
|
|
113
|
+
type: 'number',
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
returnType: 'string',
|
|
117
|
+
returnDescription: 'The URL of the requested MMS content from the inbound message.',
|
|
118
|
+
syntax: 'MMS_Content_URL(position)',
|
|
119
|
+
example: '%%=MMS_Content_URL(0)=%%',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'Msg',
|
|
123
|
+
supportedInCloudPage: false,
|
|
124
|
+
supportedInEmail: false,
|
|
125
|
+
mcnSince: null,
|
|
126
|
+
handlebarsEquivalent: null,
|
|
127
|
+
mcnNotes: null,
|
|
128
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-msg.html',
|
|
129
|
+
guideUrl: 'https://ampscript.guide/mobileconnect-data-strings/',
|
|
130
|
+
minArgs: 1,
|
|
131
|
+
maxArgs: 1,
|
|
132
|
+
category: 'MobileConnect',
|
|
133
|
+
description:
|
|
134
|
+
'Returns the content of an inbound mobile-originated (MO) message. Only usable in MobileConnect. The only accepted argument value is 0.',
|
|
135
|
+
isConfirmed: false,
|
|
136
|
+
verificationBlocked: true,
|
|
137
|
+
verificationBlockedReason: 'no-working-invocation',
|
|
138
|
+
officialDocsNote:
|
|
139
|
+
'Could not runtime-verify on the only available context (a CloudPage GET on the child BU; no parent-BU escalation is configured on this tenant). A page containing a Msg(0) call aborted at compile time (HTTP 422) even when the call sat inside a non-matching IF branch, whereas the same page with no Msg construct rendered HTTP 200 — so the abort happens at parse time, before any runtime gate. This matches the official reference, which states the function is usable only in MobileConnect and not in landing pages or other content types; a CloudPage supplies no mobile-originated message to read.',
|
|
140
|
+
params: [
|
|
141
|
+
{
|
|
142
|
+
name: 'index',
|
|
143
|
+
description: 'Message index; the only accepted value is 0 (the current message)',
|
|
144
|
+
type: 'number',
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
returnType: 'string',
|
|
148
|
+
returnDescription: 'The full content of the inbound mobile-originated message.',
|
|
149
|
+
syntax: 'Msg(0)',
|
|
150
|
+
example: '%%=Msg(0)=%%',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: 'Noun',
|
|
154
|
+
supportedInCloudPage: false,
|
|
155
|
+
supportedInEmail: false,
|
|
156
|
+
mcnSince: null,
|
|
157
|
+
handlebarsEquivalent: null,
|
|
158
|
+
mcnNotes: null,
|
|
159
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-noun.html',
|
|
160
|
+
guideUrl: 'https://ampscript.guide/mobileconnect-data-strings/',
|
|
161
|
+
minArgs: 1,
|
|
162
|
+
maxArgs: 1,
|
|
163
|
+
category: 'MobileConnect',
|
|
164
|
+
description:
|
|
165
|
+
'Returns a single word that follows the keyword in an inbound mobile-originated (MO) message, by position. Only usable in MobileConnect, chained off Msg(0).',
|
|
166
|
+
isConfirmed: false,
|
|
167
|
+
verificationBlocked: true,
|
|
168
|
+
verificationBlockedReason: 'no-working-invocation',
|
|
169
|
+
officialDocsNote:
|
|
170
|
+
'Could not runtime-verify on the only available context (a CloudPage GET on the child BU; no parent-BU escalation on this tenant). Noun is chained off Msg(0), and any page containing a Msg(0) construct aborts at compile time (HTTP 422) on a CloudPage while an otherwise identical page without it renders HTTP 200. This matches the official reference, which restricts the function to MobileConnect and forbids landing pages / other content types; a CloudPage supplies no mobile-originated message to parse.',
|
|
171
|
+
params: [
|
|
172
|
+
{
|
|
173
|
+
name: 'position',
|
|
174
|
+
description:
|
|
175
|
+
'Zero-based index of the word after the keyword to return (0 = first word after the keyword)',
|
|
176
|
+
type: 'number',
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
returnType: 'string',
|
|
180
|
+
returnDescription: 'The requested word that follows the keyword in the inbound message.',
|
|
181
|
+
syntax: 'Msg(0).Noun(position)',
|
|
182
|
+
example: '%%=Msg(0).Noun(1)=%%',
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
name: 'Nouns',
|
|
186
|
+
supportedInCloudPage: false,
|
|
187
|
+
supportedInEmail: false,
|
|
188
|
+
mcnSince: null,
|
|
189
|
+
handlebarsEquivalent: null,
|
|
190
|
+
mcnNotes: null,
|
|
191
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-nouns.html',
|
|
192
|
+
guideUrl: 'https://ampscript.guide/mobileconnect-data-strings/',
|
|
193
|
+
minArgs: 0,
|
|
194
|
+
maxArgs: 0,
|
|
195
|
+
category: 'MobileConnect',
|
|
196
|
+
description:
|
|
197
|
+
'Returns all message content that follows the keyword in an inbound mobile-originated (MO) message. Only usable in MobileConnect, chained off Msg(0). Takes no arguments.',
|
|
198
|
+
isConfirmed: false,
|
|
199
|
+
verificationBlocked: true,
|
|
200
|
+
verificationBlockedReason: 'no-working-invocation',
|
|
201
|
+
officialDocsNote:
|
|
202
|
+
'Could not runtime-verify on the only available context (a CloudPage GET on the child BU; no parent-BU escalation on this tenant). Nouns is chained off Msg(0), and any page containing a Msg(0) construct aborts at compile time (HTTP 422) on a CloudPage while an otherwise identical page without it renders HTTP 200. This matches the official reference, which restricts the function to MobileConnect and forbids landing pages / other content types; a CloudPage supplies no mobile-originated message to parse.',
|
|
203
|
+
params: [],
|
|
204
|
+
returnType: 'string',
|
|
205
|
+
returnDescription: 'All content that follows the keyword in the inbound message.',
|
|
206
|
+
syntax: 'Msg(0).Nouns',
|
|
207
|
+
example: '%%=Msg(0).Nouns=%%',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: 'SetSmsConversationNextKeyword',
|
|
211
|
+
supportedInCloudPage: true,
|
|
212
|
+
supportedInEmail: true,
|
|
213
|
+
mcnSince: null,
|
|
214
|
+
handlebarsEquivalent: null,
|
|
215
|
+
mcnNotes: null,
|
|
216
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-set-sms-conversation-next-keyword.html',
|
|
217
|
+
guideUrl: 'https://ampscript.guide/setsmsconversationnextkeyword/',
|
|
218
|
+
minArgs: 3,
|
|
219
|
+
maxArgs: 3,
|
|
220
|
+
category: 'MobileConnect',
|
|
221
|
+
description:
|
|
222
|
+
'Sets the keyword for the next path of an existing SMS conversation, applied when the contact next replies. Does not create a new conversation. Returns true when set inside a MobileConnect message context, and false in any other context (for example a CloudPage or email). The success path cannot be exercised outside a live MobileConnect send.',
|
|
223
|
+
isConfirmed: true,
|
|
224
|
+
differsFromOfficialDocs: true,
|
|
225
|
+
officialDocsNote:
|
|
226
|
+
'The out-of-context return is confirmed in two independent runtime contexts: a CloudPage on the child BU and an email render on the child BU. Being an ordinary function call, it compiles and evaluates in both: on the CloudPage, called with a real short code, the authorized destination number and a keyword, it returned the literal boolean false with the page rendering fully, no SMS sent and no conversation state changed; in an email body the same call rendered the literal False through the Email Preview API. This confirms the ampscript.guide claim that the function returns false outside a MobileConnect message context; the official Salesforce reference omits this and describes only the in-context behaviour. The success path (true, keyword actually set) requires a live MobileConnect message context and cannot be reproduced in a CloudPage or email; only the out-of-context false-return is exercisable, and it is proven. The catalogued signature was corrected here: the three parameters are originationNumber, destinationNumber and keyword, and the return is a boolean, not void. A docUrl to the official reference was also added.',
|
|
227
|
+
params: [
|
|
228
|
+
{
|
|
229
|
+
name: 'originationNumber',
|
|
230
|
+
description: 'The MobileConnect short code or long code used to send',
|
|
231
|
+
type: 'string',
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: 'destinationNumber',
|
|
235
|
+
description: "The contact's phone number, including country code",
|
|
236
|
+
type: 'string',
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
name: 'keyword',
|
|
240
|
+
description: 'The string to set as the next conversation keyword',
|
|
241
|
+
type: 'string',
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
returnType: 'boolean',
|
|
245
|
+
returnDescription:
|
|
246
|
+
'true when the next keyword is set inside a MobileConnect message context; false in any other context (proven on a CloudPage). Fails with an exception in-context if unsuccessful.',
|
|
247
|
+
syntax: 'SetSmsConversationNextKeyword(originationNumber, destinationNumber, keyword)',
|
|
248
|
+
example: '%%=SetSmsConversationNextKeyword("12345", MOBILE_NUMBER, "EXAMPLE")=%%',
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
name: 'UpsertContact',
|
|
252
|
+
supportedInCloudPage: true,
|
|
253
|
+
supportedInEmail: true,
|
|
254
|
+
mcnSince: null,
|
|
255
|
+
handlebarsEquivalent: null,
|
|
256
|
+
mcnNotes: null,
|
|
257
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-contacts/mc-ampscript-reference-contacts-upsert-contact.html',
|
|
258
|
+
guideUrl: 'https://ampscript.guide/upsertcontact/',
|
|
259
|
+
sfmcGuideUrl: 'https://sfmc.guide/engagement/ampscript/functions/upsertcontact/',
|
|
260
|
+
minArgs: 5,
|
|
261
|
+
maxArgs: INF,
|
|
262
|
+
category: 'MobileConnect',
|
|
263
|
+
description:
|
|
264
|
+
"Upserts attributes onto a mobile contact matched by phone number. If the contact exists it is updated; otherwise a new contact is created. Returns a status code: 0 when the upsert succeeds and 1 when an error occurs. The only supported channel is 'mobile' and the only supported match attribute is 'phone'. An unknown attribute name returns the error status without writing anything.",
|
|
265
|
+
isConfirmed: true,
|
|
266
|
+
differsFromOfficialDocs: false,
|
|
267
|
+
officialDocsNote:
|
|
268
|
+
'Both return tokens were runtime-proven on the child BU. The success status 0 was proven by creating a brand-new mobile contact keyed on an opaque, unreachable phone number in a reserved test range with a documented system attribute (_ZipCode); calling the same key a second time with a different value updated that contact and again returned 0, so both the create and update branches of the upsert return 0. The error status 1 was proven three independent ways (unsupported channel, unsupported match attribute, non-numeric phone) and again by passing an attribute name that is not a defined MobileConnect attribute — each returned 1 with the page rendering fully and no write performed. The return is a status code (0 success / 1 error), not a count of records. The phone-number argument accepts both an integer literal and a numeric string (both returned 0 for a successful create). runtime matches the official reference, so differsFromOfficialDocs stays false.',
|
|
269
|
+
params: [
|
|
270
|
+
{
|
|
271
|
+
name: 'channel',
|
|
272
|
+
description: "The contact channel. The only supported value is 'mobile'",
|
|
273
|
+
type: 'string',
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
name: 'attribute',
|
|
277
|
+
description:
|
|
278
|
+
"The attribute to use to match the contact. The only supported value is 'phone'",
|
|
279
|
+
type: 'string',
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: 'phoneNumber',
|
|
283
|
+
description: 'The phone number of the contact, including the country code',
|
|
284
|
+
type: 'string|number',
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
name: 'keyToUpsert1',
|
|
288
|
+
description: 'The name of the attribute to upsert',
|
|
289
|
+
type: 'string',
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: 'valueToUpsert1',
|
|
293
|
+
description: 'The value of the attribute to upsert',
|
|
294
|
+
type: 'string',
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
name: 'keyToUpsertN',
|
|
298
|
+
mcnSince: null,
|
|
299
|
+
mcnNotes: null,
|
|
300
|
+
description: 'Additional attribute name',
|
|
301
|
+
type: 'string',
|
|
302
|
+
optional: true,
|
|
303
|
+
},
|
|
304
|
+
{ name: 'valueToUpsertN', description: 'Additional attribute value', optional: true },
|
|
305
|
+
],
|
|
306
|
+
returnType: 'number',
|
|
307
|
+
returnEnum: [0, 1],
|
|
308
|
+
returnDescription:
|
|
309
|
+
'A status code: 0 when the upsert succeeds (both creating a new contact and updating an existing one), 1 when an error occurs. Both tokens were proven at runtime.',
|
|
310
|
+
repeat: [{ startIndex: 3, groupSize: 2, minGroups: 1 }],
|
|
311
|
+
syntax: 'UpsertContact(channel, attribute, phoneNumber, keyToUpsert1, valueToUpsert1[, keyToUpsertN, valueToUpsertN, ...])',
|
|
312
|
+
example: "%%=UpsertContact('mobile', 'phone', 14255550142, '_ZipCode', '98026')=%%",
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
name: 'Verb',
|
|
316
|
+
supportedInCloudPage: false,
|
|
317
|
+
supportedInEmail: false,
|
|
318
|
+
mcnSince: null,
|
|
319
|
+
handlebarsEquivalent: null,
|
|
320
|
+
mcnNotes: null,
|
|
321
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-verb.html',
|
|
322
|
+
guideUrl: 'https://ampscript.guide/mobileconnect-data-strings/',
|
|
323
|
+
minArgs: 0,
|
|
324
|
+
maxArgs: 0,
|
|
325
|
+
category: 'MobileConnect',
|
|
326
|
+
description:
|
|
327
|
+
'Returns the keyword (verb) from an inbound mobile-originated (MO) message. Only usable in MobileConnect, chained off Msg(0). Takes no arguments.',
|
|
328
|
+
isConfirmed: false,
|
|
329
|
+
verificationBlocked: true,
|
|
330
|
+
verificationBlockedReason: 'no-working-invocation',
|
|
331
|
+
officialDocsNote:
|
|
332
|
+
'Could not runtime-verify on the only available context (a CloudPage GET on the child BU; no parent-BU escalation on this tenant). Verb is chained off Msg(0), and any page containing a Msg(0) construct aborts at compile time (HTTP 422) on a CloudPage while an otherwise identical page without it renders HTTP 200. This matches the official reference, which restricts the function to MobileConnect and forbids landing pages / other content types; a CloudPage supplies no mobile-originated message to parse.',
|
|
333
|
+
params: [],
|
|
334
|
+
returnType: 'string',
|
|
335
|
+
returnDescription: 'The keyword (first word) of the inbound mobile-originated message.',
|
|
336
|
+
syntax: 'Msg(0).Verb',
|
|
337
|
+
example: '%%=Msg(0).Verb=%%',
|
|
338
|
+
},
|
|
339
|
+
];
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
// AUTO-SPLIT from the original single-file src/index.js. Data moved verbatim.
|
|
2
|
+
// AMPscript FUNCTIONS — category: Sales and Service Cloud (5 entries).
|
|
3
|
+
|
|
4
|
+
import { INF } from '../constants.js';
|
|
5
|
+
|
|
6
|
+
export const SALES_SERVICE_CLOUD_FUNCTIONS = [
|
|
7
|
+
{
|
|
8
|
+
name: 'CreateSalesforceObject',
|
|
9
|
+
supportedInCloudPage: true,
|
|
10
|
+
supportedInEmail: true,
|
|
11
|
+
mcnSince: null,
|
|
12
|
+
handlebarsEquivalent: null,
|
|
13
|
+
mcnNotes: null,
|
|
14
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-salesforce/mc-ampscript-reference-salesforce-create-object.html',
|
|
15
|
+
guideUrl: 'https://ampscript.guide/createsalesforceobject/',
|
|
16
|
+
sfmcGuideUrl: 'https://sfmc.guide/engagement/ampscript/functions/createsalesforceobject/',
|
|
17
|
+
minArgs: 4,
|
|
18
|
+
maxArgs: INF,
|
|
19
|
+
category: 'Sales and Service Cloud',
|
|
20
|
+
description:
|
|
21
|
+
'Creates a new record in a connected Salesforce Sales or Service Cloud object via Marketing Cloud Connect and returns the 18-character ID of the created record. Requires an active Marketing Cloud Connect integration; the field names must be valid API names on the target object, and a fault (unknown object or field) aborts the whole page rather than returning an error value.',
|
|
22
|
+
isConfirmed: true,
|
|
23
|
+
differsFromOfficialDocs: false,
|
|
24
|
+
officialDocsNote:
|
|
25
|
+
'The success path was runtime-proven on the child BU, which has an active Marketing Cloud Connect integration to a real Salesforce org. Creating a benign Task with a single opaque field returned a real 18-character Salesforce ID (an 00T-prefixed Task ID), confirming the documented return shape. The fault path was also proven: an unknown object name and an unknown field name on a real object each aborted the CloudPage with HTTP 422 — the SOAP fault from the connected org propagates as an uncatchable page abort (AMPscript has no try/catch), exactly like RetrieveSalesforceObjects against an unknown object — so there is no testable error value, the function either returns an ID or aborts. AMPscript has no delete function for Salesforce objects, so the created Task remains as benign residue in the org. Catalog signature, returnType and repeat group all match the official reference and ampscript.guide, so differsFromOfficialDocs stays false.',
|
|
26
|
+
params: [
|
|
27
|
+
{
|
|
28
|
+
name: 'objectName',
|
|
29
|
+
description: 'The API name of the Salesforce object to insert the record into',
|
|
30
|
+
type: 'string',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'numFields',
|
|
34
|
+
description:
|
|
35
|
+
'The number of fields to insert. Must match the number of name-value pairs specified',
|
|
36
|
+
type: 'number',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'fieldName1',
|
|
40
|
+
description: 'The name of the field to insert in the object',
|
|
41
|
+
type: 'string',
|
|
42
|
+
},
|
|
43
|
+
{ name: 'fieldValue1', description: 'The value to insert for the field' },
|
|
44
|
+
{
|
|
45
|
+
name: 'fieldNameN',
|
|
46
|
+
mcnSince: null,
|
|
47
|
+
mcnNotes: null,
|
|
48
|
+
description: 'Additional field name',
|
|
49
|
+
type: 'string',
|
|
50
|
+
optional: true,
|
|
51
|
+
},
|
|
52
|
+
{ name: 'fieldValueN', description: 'Additional field value', optional: true },
|
|
53
|
+
],
|
|
54
|
+
returnType: 'string',
|
|
55
|
+
returnDescription: 'The 18-character ID of the newly created Salesforce object record.',
|
|
56
|
+
repeat: [{ startIndex: 2, groupSize: 2, minGroups: 1, countParam: 'numFields' }],
|
|
57
|
+
syntax: 'CreateSalesforceObject(objectName, numFields, fieldName1, fieldValue1[, fieldNameN, fieldValueN, ...])',
|
|
58
|
+
example: "%%=CreateSalesforceObject('Contact', 1, 'LastName', 'Smith')=%%",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'LongSFID',
|
|
62
|
+
supportedInCloudPage: true,
|
|
63
|
+
supportedInEmail: true,
|
|
64
|
+
mcnSince: null,
|
|
65
|
+
handlebarsEquivalent: null,
|
|
66
|
+
mcnNotes: null,
|
|
67
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-salesforce/mc-ampscript-reference-salesforce-long-sfid.html',
|
|
68
|
+
guideUrl: 'https://ampscript.guide/longsfid/',
|
|
69
|
+
sfmcGuideUrl: 'https://sfmc.guide/engagement/ampscript/functions/longsfid/',
|
|
70
|
+
isConfirmed: true,
|
|
71
|
+
differsFromOfficialDocs: false,
|
|
72
|
+
minArgs: 1,
|
|
73
|
+
maxArgs: 1,
|
|
74
|
+
category: 'Sales and Service Cloud',
|
|
75
|
+
description:
|
|
76
|
+
'Converts a 15-character case-sensitive Salesforce ID to the 18-character case-insensitive version.',
|
|
77
|
+
params: [{ name: 'sfid15', description: '15-character Salesforce ID', type: 'string' }],
|
|
78
|
+
returnType: 'string',
|
|
79
|
+
returnDescription: 'The 18-character Salesforce ID derived from the 15-character ID.',
|
|
80
|
+
syntax: 'LongSFID(sfid15)',
|
|
81
|
+
example: "%%=LongSFID('001A000000ABCDE')=%%",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'RetrieveSalesforceJobSources',
|
|
85
|
+
supportedInCloudPage: true,
|
|
86
|
+
supportedInEmail: true,
|
|
87
|
+
mcnSince: null,
|
|
88
|
+
handlebarsEquivalent: null,
|
|
89
|
+
mcnNotes: null,
|
|
90
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-salesforce/mc-ampscript-reference-salesforce-retrieve-job-sources.html',
|
|
91
|
+
guideUrl: 'https://ampscript.guide/retrievesalesforcejobsources/',
|
|
92
|
+
sfmcGuideUrl:
|
|
93
|
+
'https://sfmc.guide/engagement/ampscript/functions/retrievesalesforcejobsources/',
|
|
94
|
+
isConfirmed: true,
|
|
95
|
+
differsFromOfficialDocs: false,
|
|
96
|
+
minArgs: 1,
|
|
97
|
+
maxArgs: 1,
|
|
98
|
+
category: 'Sales and Service Cloud',
|
|
99
|
+
description:
|
|
100
|
+
'Retrieves the source records (SourceID, SourceType, IsInclusionSource) that made up the audience of a Salesforce-triggered send, matched by its numeric job ID, and returns them as a rowset. Requires an active Marketing Cloud Connect integration. A job ID with no matching sources returns an empty rowset rather than an error; the function reports nothing about the job status.',
|
|
101
|
+
params: [
|
|
102
|
+
{
|
|
103
|
+
name: 'jobId',
|
|
104
|
+
description: 'The numeric job ID of the Salesforce send',
|
|
105
|
+
type: 'number',
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
returnType: 'rowset',
|
|
109
|
+
returnDescription:
|
|
110
|
+
'A rowset of the send sources (SourceID, SourceType, IsInclusionSource); an empty rowset when the job ID has no matching sources.',
|
|
111
|
+
syntax: 'RetrieveSalesforceJobSources(jobId)',
|
|
112
|
+
example: '%%[ SET @rows = RetrieveSalesforceJobSources(@jobId) ]%%',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: 'RetrieveSalesforceObjects',
|
|
116
|
+
supportedInCloudPage: true,
|
|
117
|
+
supportedInEmail: true,
|
|
118
|
+
mcnSince: 67,
|
|
119
|
+
handlebarsEquivalent: 'query',
|
|
120
|
+
handlebarsExact: false,
|
|
121
|
+
mcnNotes: null,
|
|
122
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-salesforce/mc-ampscript-reference-salesforce-retrieve-objects.html',
|
|
123
|
+
guideUrl: 'https://ampscript.guide/retrievesalesforceobjects/',
|
|
124
|
+
sfmcGuideUrl:
|
|
125
|
+
'https://sfmc.guide/engagement/ampscript/functions/retrievesalesforceobjects/',
|
|
126
|
+
isConfirmed: true,
|
|
127
|
+
differsFromOfficialDocs: false,
|
|
128
|
+
minArgs: 5,
|
|
129
|
+
maxArgs: INF,
|
|
130
|
+
category: 'Sales and Service Cloud',
|
|
131
|
+
description:
|
|
132
|
+
'Retrieves records from a connected Salesforce Sales or Service Cloud object via Marketing Cloud Connect and returns them as a rowset. Requires an active Marketing Cloud Connect integration; a call against an unknown object name aborts the page.',
|
|
133
|
+
params: [
|
|
134
|
+
{
|
|
135
|
+
name: 'objectName',
|
|
136
|
+
description: 'The API name of the Salesforce object to retrieve information from',
|
|
137
|
+
type: 'string',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: 'fieldsToRetrieve',
|
|
141
|
+
description: 'A comma-separated list of fields to retrieve information from',
|
|
142
|
+
type: 'string',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: 'queryFieldName1',
|
|
146
|
+
description: 'The name of the field to filter on',
|
|
147
|
+
type: 'string',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: 'queryFieldOperator1',
|
|
151
|
+
description: 'The comparison operator to use for the filter',
|
|
152
|
+
type: 'string',
|
|
153
|
+
enum: ['=', '!=', '<', '<=', '>', '>='],
|
|
154
|
+
},
|
|
155
|
+
{ name: 'queryFieldValue1', description: 'The value to filter on' },
|
|
156
|
+
{
|
|
157
|
+
name: 'queryFieldNameN',
|
|
158
|
+
description: 'Additional filter field name (joined with AND)',
|
|
159
|
+
type: 'string',
|
|
160
|
+
optional: true,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'queryFieldOperatorN',
|
|
164
|
+
description: 'Additional comparison operator',
|
|
165
|
+
type: 'string',
|
|
166
|
+
enum: ['=', '!=', '<', '<=', '>', '>='],
|
|
167
|
+
optional: true,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: 'queryFieldValueN',
|
|
171
|
+
description: 'Additional filter value',
|
|
172
|
+
optional: true,
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
returnType: 'rowset',
|
|
176
|
+
returnDescription: 'A rowset of matching Salesforce object records.',
|
|
177
|
+
repeat: [{ startIndex: 2, groupSize: 3, minGroups: 1 }],
|
|
178
|
+
syntax: 'RetrieveSalesforceObjects(objectName, fieldsToRetrieve, queryFieldName1, queryFieldOperator1, queryFieldValue1[, queryFieldNameN, queryFieldOperatorN, queryFieldValueN, ...])',
|
|
179
|
+
example:
|
|
180
|
+
"%%[ SET @rows = RetrieveSalesforceObjects('Contact', 'Id,Email', 'LastName', '=', 'Smith') ]%%",
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: 'UpdateSingleSalesforceObject',
|
|
184
|
+
supportedInCloudPage: true,
|
|
185
|
+
supportedInEmail: true,
|
|
186
|
+
mcnSince: null,
|
|
187
|
+
handlebarsEquivalent: null,
|
|
188
|
+
mcnNotes: null,
|
|
189
|
+
docUrl: 'https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-salesforce/mc-ampscript-reference-salesforce-update-single-object.html',
|
|
190
|
+
guideUrl: 'https://ampscript.guide/updatesinglesalesforceobject/',
|
|
191
|
+
sfmcGuideUrl:
|
|
192
|
+
'https://sfmc.guide/engagement/ampscript/functions/updatesinglesalesforceobject/',
|
|
193
|
+
minArgs: 4,
|
|
194
|
+
maxArgs: INF,
|
|
195
|
+
category: 'Sales and Service Cloud',
|
|
196
|
+
description:
|
|
197
|
+
'Updates a single record in a connected Salesforce Sales or Service Cloud object via Marketing Cloud Connect. Accepts one or more field name and value pairs. Returns 1 on success; per the official reference it returns 0 on failure, but on a CloudPage a failed update (unknown object, malformed or non-existent record ID) instead surfaces the SOAP fault as an uncatchable page abort rather than returning 0.',
|
|
198
|
+
isConfirmed: true,
|
|
199
|
+
differsFromOfficialDocs: false,
|
|
200
|
+
officialDocsNote:
|
|
201
|
+
'The success token 1 was runtime-proven on the child BU, which has an active Marketing Cloud Connect integration to a real Salesforce org: updating one field of a record created moments earlier in the same run (a benign Task) returned the literal 1 with the page rendering fully. The failure token 0 is NOT observable in CloudPage GET context: every safe induced failure (unknown object, a malformed ID, and a well-formed but non-existent Lead ID at both 15 and 18 characters, on a real field) aborted the whole page with HTTP 422 — the SOAP fault propagates as an uncatchable page abort (identical to CreateSalesforceObject and RetrieveSalesforceObjects against a bad target), so the documented 0 return never materialises to be read. returnEnum is therefore left unset: only 1 is provable here, and asserting a [0,1] enum would ship the unproven 0 token. returnType stays number and the 0/1 semantics are retained in the description as a documented fact attributed to the official reference. The 0-on-CloudPage-abort behaviour is a context observation, not a contradiction of the send/preview-context 0/1 contract, so differsFromOfficialDocs stays false.',
|
|
202
|
+
params: [
|
|
203
|
+
{
|
|
204
|
+
name: 'objectName',
|
|
205
|
+
description: 'The API name of the Salesforce object to update',
|
|
206
|
+
type: 'string',
|
|
207
|
+
},
|
|
208
|
+
{ name: 'idToUpdate', description: 'The ID of the record to update', type: 'string' },
|
|
209
|
+
{
|
|
210
|
+
name: 'fieldName1',
|
|
211
|
+
description: 'The name of the first field to update',
|
|
212
|
+
type: 'string',
|
|
213
|
+
},
|
|
214
|
+
{ name: 'fieldValue1', description: 'The value to assign to the first named field' },
|
|
215
|
+
{
|
|
216
|
+
name: 'fieldNameN',
|
|
217
|
+
description: 'Additional field name',
|
|
218
|
+
type: 'string',
|
|
219
|
+
optional: true,
|
|
220
|
+
},
|
|
221
|
+
{ name: 'fieldValueN', description: 'Additional field value', optional: true },
|
|
222
|
+
],
|
|
223
|
+
returnType: 'number',
|
|
224
|
+
returnDescription:
|
|
225
|
+
'1 when the record was updated successfully (runtime-proven). Per the official reference a failed update returns 0, but on a CloudPage a failure aborts the page (HTTP 422) instead of returning 0, so the 0 token is not observable in that context.',
|
|
226
|
+
repeat: [{ startIndex: 2, groupSize: 2, minGroups: 1 }],
|
|
227
|
+
syntax: 'UpdateSingleSalesforceObject(objectName, idToUpdate, fieldName1, fieldValue1[, fieldNameN, fieldValueN, ...])',
|
|
228
|
+
example: "%%=UpdateSingleSalesforceObject('Contact', @recordId, 'LastName', 'Smith')=%%",
|
|
229
|
+
},
|
|
230
|
+
];
|