AMPscript Function Reference
Per-function AMPscript reference pages for Marketing Cloud Engagement. Every page is proven by running the function on a live Engagement CloudPage — signature, argument handling, edge cases, and the test script that produced the evidence.
This is the runtime-proven half of the AMPscript reference. Every function in the language catalog is listed below, but only the ones marked Verified have a page. Each of those pages documents one function as it actually behaves on a live Marketing Cloud Engagement CloudPage — what the signature really accepts, what happens on the edges, and the AMPscript that produced the evidence. Nothing on those pages is inferred from reading a doc page.
Rows marked Catalogued are listed from the language catalog so the full surface is browsable and the sweep has a visible progress surface — their runtime behaviour has not been proven here, and they have no page yet. Use the AMPscript guidance page and ampscript.guide for those in the meantime.
All functions
Verified means the function completed a runtime sweep on a live Engagement CloudPage and has a reference page — the name links to it. Catalogued means the signature below comes from the language catalog and has not been proven here; use ampscript.guide for those until a sweep reaches them.
| Function | Category | Returns | State | Description |
|---|---|---|---|---|
Add
|
Math | number |
Verified | Computes the sum of two numeric values. |
AddMscrmListMember
|
Microsoft Dynamics CRM | void |
Catalogued | Appends a member to a Dynamics CRM list. |
AddObjectArrayItem
|
Marketing Cloud API | void |
Catalogued | Appends an item to an API object's array property. |
AttachFile
|
Content | void |
Catalogued | Includes a file attachment in the outgoing message. |
AttributeValue
|
Utility | string |
Catalogued | Safely retrieves a subscriber attribute value, returning empty string if null. |
AuthenticatedEmployeeID
|
Utility | string |
Catalogued | Returns the employee ID of the currently authenticated user. |
AuthenticatedEmployeeNotificationAddress
|
Utility | string |
Catalogued | Returns the notification email address of the authenticated employee. |
AuthenticatedEmployeeUserName
|
Utility | string |
Catalogued | Returns the username of the authenticated employee. |
AuthenticatedEnterpriseID
|
Utility | string |
Catalogued | Returns the enterprise ID (top-level MID) of the authenticated user. |
AuthenticatedMemberID
|
Utility | string |
Catalogued | Returns the member ID (MID) of the authenticated business unit. |
AuthenticatedMemberName
|
Utility | string |
Catalogued | Returns the name of the authenticated business unit. |
BarcodeURL
|
Content | string |
Catalogued | Generates a URL pointing to a barcode image rendered from the given parameters. |
Base64Decode
|
Encryption and Encoding | string |
Catalogued | Decodes a Base64-encoded string. |
Base64Encode
|
Encryption and Encoding | string |
Catalogued | Encodes a value as a Base64 string. |
BeginImpressionRegion
|
Content | void |
Catalogued | Marks the start of an impression tracking region. |
BuildOptionList
|
Content | string |
Catalogued | Builds HTML <option> elements from a data extension for use in a <select> dropdown. |
BuildRowsetFromJSON
|
Content | rowset |
Catalogued | Parses a JSON string and returns a rowset. |
BuildRowSetFromString
|
Content | rowset |
Catalogued | Splits a delimited string into a single-column rowset. |
BuildRowSetFromXML
|
Content | rowset |
Catalogued | Parses an XML string using an XPath expression and returns a rowset. |
Char
|
String | string |
Catalogued | Returns the character for the given ASCII code. |
ClaimRow
|
Data Extension | row |
Catalogued | Atomically claims an unclaimed row in a data extension by setting a key column value. |
ClaimRowValue
|
Data Extension | string |
Catalogued | Atomically claims a row and returns a specific column value from it. |
CloudPagesURL
|
Utility | string |
Catalogued | Generates a secure, encrypted URL to a CloudPages landing page, optionally passing name-value parameters. |
Concat
|
String | string |
Verified | Concatenates two or more string values. |
ContentAreadeprecated
|
Content | string |
Catalogued | Inserts a classic content area by its numeric ID. |
ContentAreaByNamedeprecated
|
Content | string |
Catalogued | Inserts a classic content area by its folder path and name. |
ContentBlockByID
|
Content | string |
Catalogued | Retrieves and renders a Content Builder content block by its numeric ID. |
ContentBlockByKey
|
Content | string |
Catalogued | Retrieves and renders a Content Builder content block by its customer key. |
ContentBlockByName
|
Content | string |
Catalogued | Retrieves and renders a Content Builder content block by its folder path and name. |
ContentImageByID
|
Content | string |
Catalogued | Returns the URL of a Content Builder image asset by its numeric ID. |
ContentImageByKey
|
Content | string |
Catalogued | Returns the URL of a Content Builder image asset by its customer key. |
CreateMSCRMRecord
|
Microsoft Dynamics CRM | string |
Catalogued | Creates a new record in Microsoft Dynamics CRM. |
CreateObject
|
Marketing Cloud API | object |
Catalogued | Instantiates a Marketing Cloud SOAP API object for use with Invoke* functions. |
CreateSalesforceObject
|
Sales and Service Cloud | string |
Catalogued | Creates a new record in a connected Salesforce CRM object. |
CreateSmsConversation
|
MobileConnect | void |
Catalogued | Initiates an SMS conversation on a MobileConnect short code. |
DataExtensionRowCount
|
Data Extension | number |
Catalogued | Returns the total number of rows in a data extension. |
DateAdd
|
Date and Time | date |
Catalogued | Adds a specified interval to a date value. |
DateDiff
|
Date and Time | number |
Catalogued | Returns the difference between two dates in the specified interval. |
DateParse
|
Date and Time | date |
Catalogued | Parses a date string into a date value. |
DatePart
|
Date and Time | string |
Catalogued | Extracts a specific component from a date value. |
DecryptSymmetric
|
Encryption and Encoding | string |
Catalogued | Decrypts a value using symmetric key encryption. |
DeleteData
|
Data Extension | number |
Catalogued | Deletes rows from a data extension matching the specified key column criteria. |
DeleteDE
|
Data Extension | number |
Catalogued | Deletes rows from a data extension. Email-context variant of DeleteData. |
DescribeMSCRMEntities
|
Microsoft Dynamics CRM | rowset |
Catalogued | Returns a rowset describing all available Dynamics CRM entity types. |
DescribeMSCRMEntityAttributes
|
Microsoft Dynamics CRM | rowset |
Catalogued | Returns a rowset of attributes for the specified CRM entity type. |
Divide
|
Math | number |
Verified | Divides the first number by the second. |
Domain
|
Utility | string |
Catalogued | Extracts the domain portion from an email address. |
Empty
|
Utility | boolean |
Catalogued | Returns true if the value is empty, null, or not defined. |
EncryptSymmetric
|
Encryption and Encoding | string |
Catalogued | Encrypts a value using symmetric key encryption. |
EndImpressionRegion
|
Content | void |
Catalogued | Marks the end of an impression tracking region. |
EndSmsConversation
|
MobileConnect | void |
Catalogued | Ends an active SMS conversation on a short code. |
ExecuteFilter
|
Data Extension | rowset |
Catalogued | Executes a predefined data filter and returns the resulting rowset. |
ExecuteFilterOrderedRows
|
Data Extension | rowset |
Catalogued | Executes a predefined data filter and returns results sorted by a column. |
Field
|
Data Extension | string |
Catalogued | Retrieves the value of a specific field from a rowset row. |
Format
|
Utility | string |
Catalogued | Formats a value using a .NET format string. |
FormatCurrency
|
Utility | string |
Catalogued | Formats a number as a currency string. |
FormatDate
|
Date and Time | string |
Catalogued | Formats a date string according to the specified date and time format patterns. |
FormatNumber
|
Utility | string |
Catalogued | Formats a number using a format pattern. |
GetJWT
|
Encryption and Encoding | string |
Catalogued | Generates a JSON Web Token using the supplied claims, algorithm, and secret. |
GetJWTByKeyName
|
Encryption and Encoding | string |
Catalogued | Generates a JSON Web Token using a named encryption key from Key Management. |
GetPortfolioItem
|
Content | string |
Catalogued | Retrieves metadata for a classic portfolio item. |
GetPublishedSocialContent
|
Social | string |
Catalogued | Retrieves published social media content by its identifier. |
GetSendTime
|
Date and Time | date |
Catalogued | Returns the scheduled send time for the current job. In STO context returns the Einstein-optimized time. |
GetSocialPublishURL
|
Social | string |
Catalogued | Returns HTML for sharing a content region on a supported social network via Social Forward. Optionally accepts repeating key/value parameter pairs. |
GetSocialPublishURLByName
|
Social | string |
Catalogued | Returns HTML for sharing a content region on a supported social network (identified by name) via Social Forward. Optionally accepts repeating key/value parameter pairs. |
GUID
|
Utility | string |
Catalogued | Generates a new globally unique identifier (GUID). |
HTTPGet
|
HTTP | string |
Catalogued | Performs an HTTP GET request and returns the response body. |
HTTPPost
|
HTTP | number |
Catalogued | Performs an HTTP POST request. The response body is stored in the output variable. |
HTTPPost2
|
HTTP | number |
Catalogued | Performs an HTTP POST with access to response headers. Response body and headers are stored in output variables. |
HTTPPostWithRetry
|
HTTP | number |
Catalogued | Posts content to the specified URL with automatic retry logic on failure. Similar to HTTPPost2 but adds configurable retries and rescheduling. |
HTTPRequestHeader
|
HTTP | string |
Catalogued | Returns the value of a specified HTTP request header from the inbound request. |
IIf
|
Utility | string |
Catalogued | Returns one of two values based on a boolean expression (inline if). |
Image
|
Content | string |
Catalogued | Returns an HTML img tag for the Portfolio image matching the specified external key. |
IndexOf
|
String | number |
Catalogued | Returns the 1-based position of the first occurrence of a substring. |
InsertData
|
Data Extension | number |
Catalogued | Inserts a new row into a data extension. |
InsertDE
|
Data Extension | number |
Catalogued | Inserts a new row into a data extension. Email-context variant of InsertData. |
InvokeCreate
|
Marketing Cloud API | string |
Catalogued | Calls the SOAP API Create method on the given API object. |
InvokeDelete
|
Marketing Cloud API | string |
Catalogued | Calls the SOAP API Delete method on the given API object. |
InvokeExecute
|
Marketing Cloud API | rowset |
Catalogued | Calls the SOAP API Execute method on the given API object and returns the API status code. |
InvokePerform
|
Marketing Cloud API | string |
Catalogued | Calls the SOAP API Perform method on the given API object. |
InvokeRetrieve
|
Marketing Cloud API | rowset |
Catalogued | Calls the SOAP API Retrieve method and returns a rowset of results. |
InvokeUpdate
|
Marketing Cloud API | string |
Catalogued | Calls the SOAP API Update method on the given API object. |
IsCHTMLBrowser
|
Utility | boolean |
Catalogued | Returns true if the subscriber's browser is identified as a compact HTML (cHTML) device. |
IsEmailAddress
|
Utility | boolean |
Catalogued | Returns true if the value is a syntactically valid email address. |
IsNull
|
Utility | boolean |
Catalogued | Returns true if the value is null. |
IsNullDefault
|
Utility | string |
Catalogued | Returns the value if not null, otherwise returns the default. |
IsPhoneNumber
|
Utility | boolean |
Catalogued | Returns true if the value is a valid phone number. |
Length
|
String | number |
Verified | Returns the number of characters in a string. |
LiveContentMicrositeURL
|
Content | string |
Catalogued | Generates a URL to a microsite page that serves live, dynamic content. |
LocalDateToSystemDate
|
Date and Time | string |
Catalogued | Converts a local date to the Marketing Cloud system date (Central Time). |
LongSFID
|
Sales and Service Cloud | string |
Catalogued | Converts a 15-character case-sensitive Salesforce ID to the 18-character case-insensitive version. |
Lookup
|
Data Extension | string |
Catalogued | Returns a single field value from the first matching row in a data extension. |
LookupOrderedRows
|
Data Extension | rowset |
Catalogued | Returns a sorted rowset of matching rows from a data extension. |
LookupOrderedRowsCS
|
Data Extension | rowset |
Catalogued | Case-sensitive version of LookupOrderedRows. Returns a sorted rowset of matching rows. |
LookupRows
|
Data Extension | rowset |
Catalogued | Returns a rowset of all matching rows from a data extension. |
LookupRowsCS
|
Data Extension | rowset |
Catalogued | Case-sensitive version of LookupRows. Returns a rowset of matching rows. |
Lowercase
|
String | string |
Verified | Converts a string to all lowercase characters. |
MD5
|
Encryption and Encoding | string |
Catalogued | Returns the MD5 hash of the input value. |
MicrositeURL
|
Utility | string |
Catalogued | Generates a tracked URL to a microsite page, optionally passing parameters. |
MMS_Content_URL
|
MobileConnect | string |
Catalogued | Returns the URL of MMS content from an inbound mobile-originated (MO) message. Only usable in MobileConnect. |
Mod
|
Math | number |
Verified | Returns the remainder after dividing the first number by the second (modulo). |
Msg
|
MobileConnect | string |
Catalogued | Returns the content of an inbound mobile-originated (MO) message. Only usable in MobileConnect. The only accepted argument value is 0. |
Multiply
|
Math | number |
Verified | Computes the product of two numeric values. |
Noun
|
MobileConnect | string |
Catalogued | 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). |
Nouns
|
MobileConnect | string |
Catalogued | 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. |
Now
|
Date and Time | date |
Catalogued | Returns the current system date and time (Central Time). Pass 1 to persist the value across renders. |
Output
|
Utility | void |
Catalogued | Writes a value to the rendered output. Used inside script blocks to emit content. |
OutputLine
|
Utility | void |
Catalogued | Writes a value followed by a line break to the rendered output. |
ProperCase
|
String | string |
Catalogued | Converts a string to proper (title) case, capitalizing the first letter of each word. |
QueryParameter
|
Utility | string |
Catalogued | Returns the value of a URL query string parameter from the current page request. |
RaiseError
|
Utility | void |
Catalogued | Raises a runtime error, optionally skipping the current subscriber or returning an API error. |
Randomdiffers
|
Math | number |
Verified | Returns a random integer between the two specified values (inclusive). Both bounds must be whole numbers; a decimal bound aborts the page. The bounds may be supplied in either order. |
RatingStars
|
Einstein Email Recommendations | string |
Catalogued | Renders a star-rating image using Einstein recommendations data. |
Redirect
|
Utility | void |
Catalogued | Performs an HTTP redirect to the specified URL. Landing pages only. |
RedirectTo
|
Utility | string |
Catalogued | Creates a trackable redirect URL, typically used in email links. |
RegExMatch
|
String | string |
Catalogued | Tests a string against a regular expression pattern and returns first occurrence of the matching regular expression pattern. |
Replace
|
String | string |
Catalogued | Replaces all occurrences of a substring with a new value. |
ReplaceList
|
String | string |
Catalogued | Replaces multiple old values in a string with a single new value. |
RequestParameter
|
Utility | string |
Catalogued | Returns the value of a form post or query string parameter from the current request. |
RetrieveMSCRMRecords
|
Microsoft Dynamics CRM | rowset |
Catalogued | Retrieves records from Dynamics CRM using a simple filter. |
RetrieveMSCRMRecordsFetchXML
|
Microsoft Dynamics CRM | rowset |
Catalogued | Retrieves records from Dynamics CRM using a FetchXML query. |
RetrieveSalesforceJobSources
|
Sales and Service Cloud | rowset |
Catalogued | Retrieves the data sources associated with a Salesforce-triggered send job. |
RetrieveSalesforceObjects
|
Sales and Service Cloud | rowset |
Catalogued | Retrieves records from a connected Salesforce CRM object. |
Row
|
Data Extension | row |
Catalogued | Returns a specific row from a rowset by its 1-based index. |
RowCount
|
Data Extension | number |
Catalogued | Returns the number of rows in a rowset. |
SetObjectProperty
|
Marketing Cloud API | void |
Catalogued | Sets a property value on a Marketing Cloud API object. |
SetSmsConversationNextKeyword
|
MobileConnect | void |
Catalogued | Sets the next expected keyword for an active SMS conversation. |
SetStateMscrmRecord
|
Microsoft Dynamics CRM | void |
Catalogued | Sets the state and status of a Dynamics CRM record. |
SHA1
|
Encryption and Encoding | string |
Catalogued | Returns the SHA-1 hash of the input value. |
SHA256
|
Encryption and Encoding | string |
Catalogued | Returns the SHA-256 hash of the input value. |
SHA512
|
Encryption and Encoding | string |
Catalogued | Returns the SHA-512 hash of the input value. |
StringToDate
|
Date and Time | date |
Catalogued | Converts a date string to a date value. |
StringToHex
|
Encryption and Encoding | string |
Catalogued | Converts a string to its hexadecimal representation. |
Substring
|
String | string |
Catalogued | Extracts a portion of a string starting at the given index for the specified length. |
Subtract
|
Math | number |
Verified | Computes the difference between two numeric values. |
SystemDateToLocalDate
|
Date and Time | string |
Catalogued | Converts a Marketing Cloud system date (Central Time) to the subscriber's local time. |
TransformXML
|
Content | string |
Catalogued | Transforms an XML document using an XSLT stylesheet. |
TreatAsContent
|
Content | string |
Catalogued | Evaluates a string as AMPscript content, rendering any embedded AMPscript expressions. |
TreatAsContentArea
|
Content | string |
Catalogued | Treats a string as a content area, optionally assigning it to an impression region. |
Trim
|
String | string |
Catalogued | Removes leading and trailing whitespace from a string. |
UpdateData
|
Data Extension | number |
Catalogued | Updates existing rows in a data extension that match the specified search columns. Returns the number of rows updated. |
UpdateDE
|
Data Extension | number |
Catalogued | Updates existing rows in a data extension. Email-context variant of UpdateData. Returns the number of rows updated. |
UpdateMSCRMRecords
|
Microsoft Dynamics CRM | number |
Catalogued | Updates one or more records in a Microsoft Dynamics CRM entity, and returns the number of successfully updated records. |
UpdateSingleSalesforceObject
|
Sales and Service Cloud | number |
Catalogued | Updates a single record in a connected Salesforce CRM object. Accepts one or more field name and value pairs. Returns 1 on success, 0 otherwise. |
Uppercase
|
String | string |
Verified | Converts a string to all uppercase characters. The German sharp s remains unchanged rather than expanding to SS. |
UpsertContact
|
MobileConnect | number |
Catalogued | Upserts attributes into a contact record. If the contact exists it is updated; otherwise a new contact is created. |
UpsertData
|
Data Extension | number |
Catalogued | Updates a row in a data extension if matching columns and values are found, or inserts a row if no matches are found. Returns the number of rows affected. |
UpsertDE
|
Data Extension | number |
Catalogued | Updates or inserts a row in a data extension. Email-context variant of UpsertData. Returns the number of rows affected. |
UpsertMSCRMRecord
|
Microsoft Dynamics CRM | string |
Catalogued | Upserts a Microsoft Dynamics CRM record. Updates the matched record or creates one if no match is found. Returns the GUID of the record. |
URLEncode
|
Encryption and Encoding | string |
Catalogued | URL-encodes a string for safe inclusion in a URL. |
v
|
Utility | string |
Catalogued | Short alias for retrieving a variable value inline. Equivalent to %%=v(@var)=%%. |
Verb
|
MobileConnect | string |
Catalogued | Returns the keyword (verb) from an inbound mobile-originated (MO) message. Only usable in MobileConnect, chained off Msg(0). Takes no arguments. |
WAT
|
Utility | string |
Catalogued | Returns the values of the Web Analytics Tracking (WAT) parameter set with the specified external key, substituting the supplied values for the matching WATP references in the Sender Profile tracking parameter. |
WATP
|
Utility | string |
Catalogued | Ordinal placeholder for a parameter value configured in a WAT parameter set. The ordinal maps to the position of the value passed to the WAT function. Configured by Marketing Cloud Support as part of the WAT string. |
WrapLongURL
|
Utility | string |
Catalogued | Wraps a long URL to prevent line-break issues in email clients. |
Shared runtime behaviour
These rules hold across the functions proven so far, and are worth internalising before reading an individual page.
A bad argument does not fail locally — it kills the page. An invalid argument count, a non-numeric string, a boolean-like string, an empty string, or a date value does not return an error value. It aborts the whole CloudPage with HTTP 422 and discards every line rendered before the failing call. There is no partial output to inspect, which is why the test scripts on these pages isolate each risky case behind its own request-parameter branch.
Numeric strings are accepted by the Math functions, everything else is not. A string that parses cleanly as a number — "15", "3.14", "-5" — is accepted exactly like the numeric literal. That is why the parameter tables list string | number rather than number. A string that does not parse as a number is rejected outright; it is never coerced to zero.
The String functions swallow booleans silently. The page returns HTTP 200 and the value simply disappears, so a stray boolean produces a sentence with a hole in it rather than an error. Numbers and date values are accepted and processed by their string form, which is why those parameter tables list string | number | date.
Related
- Differs from official docs (Engagement) — the findings where runtime behaviour contradicts or outruns the official reference
- AMPscript guidance — patterns and snippets rather than per-function reference
- ssjs.guide — the equivalent runtime-verified reference for Server-Side JavaScript