AMPscript Function Parameters
AMPscript functions use parameters that you must specify in a specific order. The reference section of this guide lists the parameters for each function in the order in which they must be passed. For example, the entry for the FormatCurrency()
function shows that it has this syntax:
FormatCurrency(number, cultureCode, decimalPlaces, currencySymbol)
In this function, the number that you want to convert to a currency value (number
), must always be listed first, followed by the locale code to use when formatting the string (cultureCode
), and so on.
Some functions have one or more optional parameters. In the FormatCurrency()
function, the last two parameters (decimalPlaces
and currencySymbol
) are optional. If you want to pass a value for the currencySymbol
, you must also pass a value for the parameter that precedes it in order (decimalPlaces
). In this situation, you can pass null
or an empty string ("") to skip over parameters that you don’t want to specify.
AMPscript functions accept any of these input types:
- Constant values, such as
Lowercase("Mary Smith")
- Attribute values, such as
Lowercase(Name)
- Variable values, such as
Lowercase(@Name)
To prevent infinite loops, you can’t call AMPscript functions recursively. Recursive functions result in a "104 - RecursiveScriptError" exception. Email, SMS, and push messages that result in this type of exception are considered "Errored/NotSent," and count against the subscriber error limit threshold.