Salesforce Marketing Cloud
Server-Side JavaScript
Reference Guide
Everything you need to write, debug, and master SSJS in SFMC — global functions, Platform APIs, Core library, WSProxy, HTTP, engine limitations, and real-world recipes.
Reference
Global Functions
Top-level functions available in every SSJS context:
Write, Stringify, TreatAsContent, content blocks, and more.12 functions
Platform Functions
The
Platform.Function.* API surface — Data Extension CRUD, strings, dates, crypto, HTTP, AMPscript bridge, and SOAP helpers.~55 functions
Platform Objects
Platform.Load, Platform.Variable, Platform.Response, Platform.Request, and Platform.ClientBrowser.5 objects · 22 methods
Core Library
SOAP-style object wrappers after
Platform.Load("core","1.1.5") — DataExtension, Subscriber, Email, TriggeredSend, and 20+ more.30 objects
WSProxy
The fastest way to call the SFMC SOAP API from SSJS.
new WSProxy() with retrieve, create, update, delete, batch, and impersonation.11 methods
HTTP & REST
All HTTP options compared:
HTTP.Get/Post, Platform.Function.HTTPGet, and Script.Util.HttpRequest for full REST verb support.3 approaches · 9 functions
Guides
Getting Started
What SSJS is, where it runs, how to embed script blocks, execution contexts, and the difference between Platform and Core.
5 pages
Language Guide
Variables, types, operators, control flow, loops, functions, objects, JSON, error handling — the ES3/5 subset that works in SFMC.
9 topics
Engine Limitations
24 ES6+ features that fail at runtime, broken Array methods, polyfills you need, and known platform bugs like the
switch default issue.4 topics · 20 polyfills
ECMAScript Builtins
Safe Array, String, and Math methods that work in the SFMC SSJS engine — tested and documented with examples.
31 safe methods
Best Practices
Debugging techniques, performance patterns, security considerations, style guide, and defensive coding for SFMC SSJS.
6 topics
Recipes
Copy-paste patterns for Cloud Page apps, AMPscript bridging, REST API calls, DE CRUD, subscribers, anti-CSRF, and encryption.
9 recipes
Quick Start
A minimal SSJS CloudPage:
<script runat="server">
Platform.Load("core", "1.1.5");
try {
var subscriberKey = Platform.Request.GetQueryStringParameter("sk");
if (subscriberKey) {
var email = Platform.Function.Lookup(
"Subscribers",
"EmailAddress",
"SubscriberKey",
subscriberKey
);
Write("<p>Hello, " + email + "</p>");
}
} catch (e) {
Write("<p>Error: " + Stringify(e) + "</p>");
}
</script>
Key points:
- SSJS runs on the server inside
<script runat="server">blocks Platform.Load("core", "1.1.5")must be called before using Core library objects- The engine is roughly ES3/5 — no arrow functions,
let/const, template literals, orasync/await - Use
Write()to output HTML,Stringify()to serialize objects,Platform.Function.ParseJSON()instead ofJSON.parse()