Global Functions
Top-level functions and objects available in every SSJS execution context without any import or Platform.Load call.
These functions and objects are available globally in any SSJS script block without requiring Platform.Load or any other initialization.
Write()
Output a string to the rendered page. The primary output mechanism for SSJS.
→ void
Stringify()
Serialize any object to its JSON string representation. SFMC's equivalent of JSON.stringify().
→ string
String()
Convert any value to a string, including CLR/.NET response objects from Script.Util.HttpRequest.
→ string
Error()
Native Error constructor for creating throwable error objects with a message property.
→ object
ContentBlockByKey()
Render a Content Builder asset by its customer key. Returns the rendered HTML.
→ string
ContentBlockByName()
Render a Content Builder asset by folder path and name.
→ string
ContentBlockByID()
Render a Content Builder asset by its numeric identifier.
→ string
ContentAreaByKey()
Render a classic content area by its external key.
→ string
TreatAsContent()
Evaluate a string containing AMPscript or HTML and return the rendered result. Security note: never pass unvalidated user input.
→ string
TreatAsContentArea()
Render a classic content area stored in the system.
→ string
Variable
Global object providing access to AMPscript variables. Use Variable.GetValue() and Variable.SetValue().
object
Attribute
Global object providing access to subscriber attribute values.
object