ssjs.guide SFMC
Function Index Get Started ❤️ Support ssjs.guide — Buy me a coffee!
Getting Started
  • What is SSJS?
  • Where SSJS Runs
  • Embedding SSJS
  • Execution Contexts
  • Platform vs Core
Language Guide
  • Variables
  • Data Types
  • Operators
  • Control Flow
  • Loops
  • Functions & Scope
  • Objects & JSON
  • Error Handling
  • Regular Expressions
Engine Limitations
  • Unsupported Syntax
  • Missing Methods
  • Polyfills
  • Known Bugs
Global Functions
  • Write
  • Stringify
  • String
  • Error
  • ContentBlockByKey
  • ContentBlockByName
  • ContentBlockByID
  • ContentAreaByKey
  • TreatAsContent
  • TreatAsContentArea
  • Variable (global)
  • Attribute (global)
Platform Functions
  • Data Extensions
  • Lookup
  • LookupRows
  • LookupOrderedRows
  • InsertData
  • InsertDE
  • UpdateData
  • UpdateDE
  • UpsertData
  • UpsertDE
  • DeleteData
  • DeleteDE
  • DataExtensionRowCount
  • Strings
  • Substring
  • Trim
  • Replace
  • IndexOf
  • Length
  • Uppercase
  • Lowercase
  • ProperCase
  • Char
  • Concat
  • Format
  • Dates
  • Now
  • DateAdd
  • DateDiff
  • DateParse
  • FormatDate
  • SystemDateToLocalDate
  • Logic & Utility
  • IsEmailAddress
  • IsNull
  • Empty
  • IIf
  • GUID
  • ParseJSON
  • URLEncode
  • AttributeValue
  • CloudPagesURL
  • MicrositeURL
  • Crypto
  • Base64Encode
  • Base64Decode
  • SHA256
  • SHA512
  • MD5
  • EncryptSymmetric
  • DecryptSymmetric
  • AMPscript Bridge
  • GetValue
  • SetValue
  • TreatAsContent
  • SOAP API
  • CreateObject
  • SetObjectProperty
  • AddObjectArrayItem
  • InvokeCreate
  • InvokeRetrieve
  • InvokeUpdate
  • InvokeDelete
  • InvokePerform
  • InvokeConfigure
  • InvokeExecute
  • HTTP
  • HTTPGet
  • HTTPPost
  • HTTPRequestHeader
  • Content
  • ContentBlockByKey
  • ContentBlockByName
  • ContentBlockByID
  • RaiseError
  • Redirect
Platform Objects
  • Platform.Load
  • Platform.Variable
  • Platform.Response
  • Platform.Request
  • Platform.ClientBrowser
Core Library
  • Overview
  • DataExtension
  • DataExtension.Fields
  • DataExtension.Rows
  • Subscriber
  • Email
  • TriggeredSend
  • List
  • List.Subscribers
  • Send
  • Template
  • ContentArea
  • Folder
  • QueryDefinition
  • FilterDefinition
  • SendDefinition
  • SendClassification
  • DeliveryProfile
  • SenderProfile
  • Account
  • AccountUser
  • Portfolio
  • Tracking Events
  • BounceEvent
  • ClickEvent
  • OpenEvent
  • SentEvent
  • UnsubEvent
  • NotSentEvent
  • ForwardedEmailEvent
  • ForwardedEmailOptInEvent
  • SurveyEvent
WSProxy
  • Overview & Constructor
  • retrieve
  • retrieveAll
  • createItem
  • updateItem
  • createBatch
  • updateBatch
  • deleteItem
  • execute
  • perform
  • setClientId
  • resetClientIds
HTTP & REST
  • HTTP Methods Overview
  • HTTP.Get
  • HTTP.Post
  • HTTP.GetRequest
  • HTTP.PostRequest
  • Platform.Function.HTTPGet
  • Platform.Function.HTTPPost
  • Script.Util.HttpRequest
  • Script.Util.HttpGet
  • Script.Util.HttpPost
  • Request Instance Methods
ECMAScript Builtins
  • Overview
  • Array Methods
  • String Methods
  • Math
Best Practices
  • Debugging
  • Performance
  • Security
  • Style Guide
  • Defensive Coding
  • Error Logging
Recipes
  • Cloud Page Apps
  • AMPscript Bridge
  • REST API Calls
  • DE CRUD Patterns
  • Subscriber Management
  • WSProxy Patterns
  • Date & Time
  • Anti-CSRF
  • Encryption
Function Index

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
ssjs.guide

The complete Server-Side JavaScript reference for Salesforce Marketing Cloud.

IDE Extensions & AI

  • VSCode SFMC Language Service - powered by ssjs.guide
  • MCP Server for SFMC - powered by ssjs.guide
  • VSCode SFMC Data Loader
  • SFMC Data Loader CLI
  • VSCode SFMC DevTools
  • SFMC DevTools CLI

ESLint

  • ESLint CLI
  • ESLint VSCode Extension
  • ESLint Plugin for SFMC - powered by ssjs.guide

Prettier

  • Prettier CLI
  • Prettier VSCode Extension
  • Prettier Plugin for SFMC - powered by ssjs.guide

© 2026 Jörn Berkefeld — LinkedIn · GitHub

The views and opinions expressed here are my own personal views and do not represent those of any employer, client, or affiliated organisation. Not affiliated with or endorsed by Salesforce.