Salesforce introduced AMPscript to Marketing Cloud Next during the Summer ’26 release, bringing one of the most useful personalization tools from Marketing Cloud Engagement into the new platform. According to the official Salesforce AMPscript function index, Marketing Cloud Next currently supports 41 AMPscript functions. Many of them became available in the Summer ’26 release, API version 67.0. I wanted to go beyond checking the documentation and see how these functions behave in an actual Marketing Cloud Next email.

So far, I have successfully executed and confirmed 35 out of the 41 supported functions. All 35 returned the expected results.
The remaining six functions require an existing Content Workspace asset, Marketing Object, Salesforce record, or deliberate send-time error. Their syntax was accepted by the email publisher, but I have not yet completed a full runtime test:
ContentBlockById()ContentBlockByKey()ContentBlockByName()Lookup()RetrieveSalesforceObjects()RaiseError()
I plan to test these functions separately with real Marketing Cloud Next assets and data. I will update this article with my findings over the next couple of weeks.
Test environment and approach
The tests were placed directly into the HTML body of a Marketing Cloud Next email. Each example used fixed input values so that the expected output could be checked easily.
The descriptions below are based on the official Salesforce AMPscript documentation, while the results come from the rendered Marketing Cloud Next email. Salesforce describes AMPscript as a scripting language that can integrate customer data with marketing content and personalize messages across communication channels.
Math functions
All five math functions supported in Marketing Cloud Next worked correctly.
Add()
The Add() function returns the sum of two numbers.
Code:
%%=Add(512,256)=%%
Result: 768
Subtract()
The Subtract() function subtracts the second number from the first number.
Code:
%%=Subtract(512,256)=%%
Result: 256
Multiply()
The Multiply() function returns the product of two numbers.
Code:
%%=Multiply(12,8)=%%
Result: 96
Divide()
The Divide() function divides the first number by the second number.
Code:
%%=Divide(512,8)=%%
Result: 64
Mod()
The Mod() function returns the remainder after dividing one number by another.
Code:
%%=Mod(17,5)=%%
Result: 2
String functions
Concat()
The Concat() function joins two or more values into one string.
Code:
%%=Concat("Marketing"," ","Cloud"," ","Next")=%%
Result: Marketing Cloud Next
IndexOf()
The IndexOf() function returns the position at which a substring begins. AMPscript uses one-based indexing, so the first character has position 1. A result of 0 means that the value was not found.
Code:
%%=IndexOf("Marketing Cloud Next","Cloud")=%%
Result: 11
Length()
The Length() function returns the number of characters in a string, including spaces.
Code:
%%=Length("Marketing Cloud Next")=%%
Result: 20
Lowercase()
The Lowercase() function converts all letters in a string to lowercase.
Code:
%%=Lowercase("MARKETING CLOUD NEXT")=%%
Result: marketing cloud next
Uppercase()
The Uppercase() function converts all letters in a string to uppercase.
Code:
%%=Uppercase("marketing cloud next")=%%
Result: MARKETING CLOUD NEXT
ProperCase()
The ProperCase() function converts the first character of each word to uppercase and the remaining characters to lowercase.
Code:
%%=ProperCase("marketing cloud next")=%%
Result: Marketing Cloud Next
Replace()
The Replace() function replaces every occurrence of a specified substring with another value.
Code:
%%=Replace("Marketing Cloud Engagement","Engagement","Next")=%%
Result: Marketing Cloud Next
ReplaceList()
The ReplaceList() function replaces several specified values in a source string with one replacement value.
Code:
%%=ReplaceList("Red|Green;Blue,Yellow"," / ","|",";",",")=%%
Result: Red / Green / Blue / Yellow
Substring()
The Substring() function returns part of a string, starting at a specified character position and continuing for a specified number of characters.
Code:
%%=Substring("Marketing Cloud Next",11,5)=%%
Result: Cloud
Trim()
The Trim() function removes leading and trailing spaces from a string.
Code:
[%%=Trim(" Marketing Cloud Next ")=%%]
Result: [Marketing Cloud Next]
The square brackets were added only to make it easier to see that the spaces had been removed.
General formatting with Format()
Format() as a number
The Format() function converts a value into a specified output format. In this example, it formats a string as a number with two decimal places.
Code:
%%=Format("1234.56","N2","Number","en_US")=%%
Result: 1,234.56
Format() as a date
Here, the same function formats a date as a long date using the US English locale.
Code:
%%=Format("2026-08-05 13:45:30","D","Date","en_US")=%%
Result: Wednesday, August 5, 2026
Date and time functions
Now()
The Now() function returns the current platform date and time.
Code:
%%=Now()=%%
Result during my test: 2026-07-14T11:08:07
The exact result naturally changes each time the email is rendered. It also represents the platform time and does not necessarily match the browser’s local timezone.
DateAdd()
The DateAdd() function adds a specified number of days, months, hours, minutes, or years to a date.
Add seven days:
%%=DateAdd(Now(),7,"D")=%%
Result: 2026-07-21T11:08:07
Add two months:
%%=DateAdd(Now(),2,"M")=%%
Result: 2026-09-14T11:08:07
DateDiff()
The DateDiff() function returns the difference between two dates using a specified unit.
Difference in days:
%%=DateDiff("2026-01-01","2026-01-31","D")=%%
Result: 30
Difference in hours:
%%=DateDiff("2026-01-01 08:00:00","2026-01-01 16:00:00","H")=%%
Result: 8
DateParse()
The DateParse() function parses a string and returns it as a date and time value.
Code:
%%=DateParse("2026-08-05 13:45:30")=%%
Result: 8/5/2026 1:45:30 PM
StringToDate()
The StringToDate() function converts a date and time string into a date value based on the applicable locale settings.
Code:
%%=StringToDate("2026-08-05 13:45:30")=%%
Result: 8/5/2026 1:45:30 PM
FormatDate()
The FormatDate() function formats a date using separate date and time patterns and an optional locale.
Code:
%%=FormatDate( "2026-08-05 13:45:30", "yyyy-MM-dd", "HH:mm:ss", "en_US" )=%%
Result: 2026-08-05 13:45:30
Number and currency formatting
FormatCurrency()
The FormatCurrency() function formats a number as currency according to the specified locale.
US English:
%%=FormatCurrency(1234.555,"en_US")=%%
Result: $1,234.56
Polish:
%%=FormatCurrency(1234.555,"pl_PL")=%%
Result: 1 234,56 zł
With the optional currency parameter:
%%=FormatCurrency(1234.555,"en_US",2,"USD ")=%%
Result: $1,234.56
This last result is worth noting. In my test, the fourth parameter did not replace the dollar symbol with the supplied USD value. The function executed successfully, but the rendered result continued to use the symbol associated with the en_US locale.
FormatNumber()
The FormatNumber() function formats a numeric value using a specified numeric format and locale. It can also convert numeric strings to numbers and round values to a specified number of decimal places.
Number with two decimal places:
%%=FormatNumber(1234.555,"N2","en_US")=%%
Result: 1,234.56
Percentage:
%%=FormatNumber(0.12883,"P2","en_US")=%%
Result: 12.88%
Utility functions
Empty()
The Empty() function checks whether a value is empty. It does not consider the number zero or a string containing whitespace to be empty.
Test setup:
%%[ VAR @emptyValue VAR @populatedValue VAR @zeroValue VAR @spaceValue SET @emptyValue = "" SET @populatedValue = "Test value" SET @zeroValue = 0 SET @spaceValue = " " ]%%
Empty string:
%%=Empty(@emptyValue)=%%
Result: true
Populated string:
%%=Empty(@populatedValue)=%%
Result: false
Numeric zero:
%%=Empty(@zeroValue)=%%
Result: false
Whitespace:
%%=Empty(@spaceValue)=%%
Result: false
I also tested Empty() inside an AMPscript condition:
%%[ VAR @conditionalResult IF Empty(@emptyValue) == true THEN SET @conditionalResult = "The value is empty" ELSE SET @conditionalResult = "The value is not empty" ENDIF ]%% %%=v(@conditionalResult)=%%
Result: The value is empty
Iif()
The Iif() function evaluates a condition. It returns its second parameter when the condition is true and its third parameter when the condition is false.
True condition:
%%=Iif(1 == 1,"TRUE result","FALSE result")=%%
Result: TRUE result
False condition:
%%=Iif(1 == 2,"TRUE result","FALSE result")=%%
Result: FALSE result
Random()
The Random() function generates a random integer within a specified range.
Code:
%%=Random(1,100)=%%
Result during my test: 57
A different result on each render is expected.
IsNull()
The IsNull() function returns true when a value is null and false when it contains a value.
Test setup:
%%[ VAR @nullValue VAR @populatedValue SET @populatedValue = "Test value" ]%%
Uninitialized variable:
%%=IsNull(@nullValue)=%%
Result: true
Populated variable:
%%=IsNull(@populatedValue)=%%
Result: false
Variables and output functions
v()
The v() function returns the value stored in a variable.
Test setup:
%%[ VAR @firstName, @middleName, @lastName, @fullName SET @firstName = "Kjell" SET @middleName = "Jakob" SET @lastName = "Larssen" SET @fullName = Concat( @firstName, " ", @middleName, " ", @lastName ) ]%%
Code:
%%=v(@fullName)=%%
Result: Kjell Jakob Larssen
Output()
The Output() function writes the result of an AMPscript expression to the rendered content.
Code:
%%[ Output( Concat( "Output: ", @fullName, "<br>" ) ) ]%%
Result: Output: Kjell Jakob Larssen
OutputLine()
The OutputLine() function writes output and adds a line break to the generated source.
Code:
%%[ OutputLine( Concat( "OutputLine: ", @fullName, "<br>" ) ) ]%%
Result: OutputLine: Kjell Jakob Larssen
The newline added by OutputLine() might not be visible in rendered HTML because browsers normally collapse source-code whitespace. The explicit HTML <br> ensures that the visible output appears on a separate line.
JSON and rowset functions
The JSON test confirmed that Marketing Cloud Next can create a rowset from hard-coded JSON and retrieve values from individual rows. Salesforce describes BuildRowsetFromJson() as a function that loads JSON data into a rowset.
Test code:
%%[ VAR @json, @jsonRowset, @jsonRowCount VAR @firstJsonRow VAR @jsonFirstName VAR @jsonLastName VAR @jsonCountry SET @json = '[{"firstName":"Anna","lastName":"Kowalska","country":"Poland"},{"firstName":"John","lastName":"Smith","country":"United States"}]' SET @jsonRowset = BuildRowsetFromJson( @json, "$[*]", true ) SET @jsonRowCount = RowCount(@jsonRowset) IF @jsonRowCount > 0 THEN SET @firstJsonRow = Row(@jsonRowset,1) SET @jsonFirstName = Field(@firstJsonRow,"firstName") SET @jsonLastName = Field(@firstJsonRow,"lastName") SET @jsonCountry = Field(@firstJsonRow,"country") ENDIF ]%%
BuildRowsetFromJson()
The function converts the JSON array into an AMPscript rowset.
SET @jsonRowset = BuildRowsetFromJson( @json, "$[*]", true )
Result: A rowset containing two rows.
RowCount()
The RowCount() function returns the number of rows in a rowset.
%%=v(@jsonRowCount)=%%
Result: 2
Row()
The Row() function returns a specific row from a rowset.
SET @firstJsonRow = Row(@jsonRowset,1)
Result: The first JSON object, containing Anna Kowalska’s values.
Field()
The Field() function returns the value of a specified field from a row.
First name:
SET @jsonFirstName = Field(@firstJsonRow,"firstName")
Result: Anna
Last name:
SET @jsonLastName = Field(@firstJsonRow,"lastName")
Result: Kowalska
Country:
SET @jsonCountry = Field(@firstJsonRow,"country")
Result: Poland
Functions still requiring runtime testing
The following six functions were accepted by the Marketing Cloud Next email publisher but were placed inside inactive conditional branches. This means that their syntax compiled successfully, but the functions were not executed against real resources.
ContentBlockById()
This function retrieves content from Marketing Cloud Next Content Workspace using its content block ID. Marketing Cloud Next content functions operate against assets in the marketing Content Workspace.
SET @contentBlockByIdResult = ContentBlockById( "REPLACE_WITH_CONTENT_BLOCK_ID", "ContentBlockById test", false, "Content block not found", @contentBlockByIdStatus )
Status: Not yet tested with a real content block ID.
ContentBlockByKey()
This function retrieves content from Content Workspace using a content block key.
SET @contentBlockByKeyResult = ContentBlockByKey( "REPLACE_WITH_CONTENT_BLOCK_KEY", "ContentBlockByKey test", false, "Content block not found", @contentBlockByKeyStatus )
Status: Not yet tested with a real content block key.
ContentBlockByName()
This function retrieves content from Content Workspace using the asset name.
SET @contentBlockByNameResult = ContentBlockByName( "REPLACE_WITH_CONTENT_BLOCK_NAME", "ContentBlockByName test", false, "Content block not found", @contentBlockByNameStatus )
Status: Not yet tested with a real content block name.
Lookup()
In Marketing Cloud Next, Lookup() returns a value from a specified field in a Marketing Object. The function searches one field for a matching value and returns another field from the matching record. If multiple records match, it returns the first result.
SET @lookupResult = Lookup( "REPLACE_WITH_OBJECT_NAME", "REPLACE_WITH_RETURN_FIELD", "REPLACE_WITH_SEARCH_FIELD", "REPLACE_WITH_SEARCH_VALUE" )
Status: Not yet tested against a real Marketing Object.
RetrieveSalesforceObjects()
This function retrieves records and selected fields from a Salesforce object using specified filter criteria.
SET @sfRows = RetrieveSalesforceObjects( "Contact", "Id,FirstName,LastName", "Email", "=", "REPLACE_WITH_EXISTING_EMAIL" )
Status: Not yet tested against an existing Salesforce record.
RaiseError()
The RaiseError() function deliberately produces an error during message processing. Because executing it can stop processing or prevent a subscriber from receiving the message, it requires a controlled send test rather than a standard email preview.
RaiseError( "Intentional Marketing Cloud Next AMPscript test error", true, "MCN_TEST_ERROR", 1001, false )
Status: Not yet executed intentionally.
Summary of the results
My test confirmed that the following 35 AMPscript functions execute correctly in Marketing Cloud Next:
Add()BuildRowsetFromJson()Concat()DateAdd()DateDiff()DateParse()Divide()Empty()Field()Format()FormatCurrency()FormatDate()FormatNumber()Iif()IndexOf()IsNull()Length()Lowercase()Mod()Multiply()Now()Output()OutputLine()ProperCase()Random()Replace()ReplaceList()Row()RowCount()StringToDate()Subtract()Substring()Trim()Uppercase()v()
The following six functions still need a full runtime test:
ContentBlockById()ContentBlockByKey()ContentBlockByName()Lookup()RetrieveSalesforceObjects()RaiseError()
Final thoughts
AMPscript support is an important addition to Marketing Cloud Next. Even with only 41 functions currently supported, the available set already covers many common personalization scenarios: calculations, string transformation, date manipulation, conditional content, formatting, JSON processing, Content Workspace references, Marketing Object lookups, and Salesforce record retrieval. The results of this first test are encouraging. Every self-contained function I tested produced the expected output, including more advanced functions. There are still some practical questions to answer, particularly around Marketing Object lookups, Content Workspace references, Salesforce record retrieval, and error handling. I will test those scenarios separately and update this article with the results over the next couple of weeks.