AMPscript Core is an open source implementation of the Marketing Cloud AMPscript language.
It is cross platform and works on Windows, macOS and Linux.
A VSCode plugin is available to edit, run and debug AMPscript files locally on your machine.
The VSCode plugin provides syntax highlighting and debugging capability for AMPscript files. The plugin supports files with a ".ampscript" extension.
It is not yet available on the VSCode marketplace. In order use it, you will need to download and install the VSIX file that contains the plugin.
If it isn't already installed on your computer, install Visual Studion Code (VS Code). You can download the latest version of VS Code from https://code.visualstudio.com/download.
If it isn't already installed on your computer, install the .NET SDK version 8.0. You can download the SDK from https://dotnet.microsoft.com/en-us/download/dotnet.
Download the latest VSIX release from the releases tab.
Install the plugin using "Install From VSIX" in the extensions menu.
Download the example ZIP from the releases tab, and unzip this somewhere on your computer.
Do File->Open Folder and choose the folder where this was unzipped.
Double click on the "dd4tmp.ampscript" file, then go to the "Run and Debug" section of the editor and click "Run and Debug".
A browser window should appear with the example running. From here - you can make any changes to the example and reload your browser window.
Subscriber attributes %%Foo%%
/[Foo]
are supported through a JSON file named subscriber.json
in the working directory.
Supported within the JSON file is a key/value pair of the attribute name and value.
Example:
{
"FirstName": "Logan"
}
The attribute values can be referenced via:
%%[
SET @FIRSTNAME = [FirstName]
]%%
Hello %%=V(@FIRSTNAME)=%%
or
Hello %%FirstName%%
Content functions can reference content local on disk. The files must exist in a Content
subdirectory of the working directory.
Example, if you have a file at Content\EmbeddedContent.ampscript
, then you can reference it via:
%%=CONTENTBLOCKBYNAME("EmbeddedContent")=%%
Data Extension support is provided through CSV files on disk. The files must exist in a DataExtensions
subdirectory of the working directory. The CSV file must contain headers which represent the columns.
Example, if you have a file at DataExtensions\Loyalty.csv
, then it will use this CSV file as the data extension.
DataExtensions\Loyalty.csv
EmailAddress,SubscriberKey,FirstName,LastName,LoyaltyLevel
[email protected],1,Donnie,Stanton,Silver
Index.ampscript
Hello %%=LOOKUP("Loyalty", "FirstName", "emailAddress", "[email protected]")=%%
Outputs:
Hello Donnie
Feature | Summary |
---|---|
Ampscript Blocks %%[]%% |
✔️ |
Variables | ✔️ |
For for |
✔️ |
If if |
✔️ |
Logic Operators == , != , && , etc |
✔️ |
Inline Ampscript %%= =%% |
✔️ |
Personalization Strings [Foo] or %%Foo%% |
✔️ |
Tag Syntax <script language="ampscript"> |
✔️ |
System Strings xtmonth, jobid, subscriberkey, etc |
⛔ Not Yet Supported |
Language | Summary |
---|---|
AMPscript | |
SSJS | ⛔ Not supported |
GTL | ⛔ Not Supported |
If the function isn't listed here, then it's not supported.
Function Area | Supported / Notes |
---|---|
Marketing Cloud API | ⛔ Not Supported |
Contact Model | ⛔ Not Supported |
Content | |
Data Extensions | |
Date and Time | |
Einstein | ⛔ Not Supported |
Encryption | ⛔ Not Supported |
HTTP | ⛔ Not Supported |
Math | ✔️ |
Microsoft Dynamics | ⛔ Not Supported |
Sales and Service Cloud | ⛔ Not Supported |
Site | ⛔ Not Supported |
Social | ⛔ Not Supported |
String | |
Utility | |
Content Syndication | ⛔ Not Supported |
- Increase supported feature
- SSJS & GTL
- Static code analysis tools to identify and remediate performance or security issues