Reference for the Adobe Campaign JavaScript API: every function with its signature, parameters, real use cases, common pitfalls and performances tests.
It is built with quality coding, efficiency and security goals in mind, as well as enabling AI-assisted coding.
Categories
- Database: query, read and write data, and manage instance options.
- XML: load shared libraries and helpers.
- Http: call external APIs and trigger webhooks with GET/POST requests.
- Log: write messages to the server logs and the workflow journal.
- Application: read the configuration & environement variables.
- File: read, write and manage files on the server.
- JSSP: build dynamic pages and JSON APIs with the request and response objects.
- Security: escalate privileges, encrypt and escape values.
Example
Find below an example of an AC JS Reference entry: π getOption.
getOption
Get an instance-specific setting from the xtk:option schema, useful for environment variable.
getOption(name: string, useCache: bool): any
Parameters
name |
string |
Internal name (@name) of the xtk:option record |
useCache |
bool |
Use the server cache |
Examples
getOption("NmsEmail_DefaultFromAddr"); // [email protected]
getOption("NmsServer_MirrorPageUrl"); // https://tracking.email.example.com
See also
-
π setOption- Set an instance-specific setting in the native xtk:option schema, useful for environment variable.
Methodology
All JavaScript functions were tested in a sandbox Adobe Campaign instance by executing the code via the acc CLI, such as:
- Global option testing, with oneliner
acc instance exec -s <script>
acc instance exec -s "context.result = getOption('NmsEmail_DefaultFromAddr')"
# <context><result>[email protected]</result></context>

- Unit tests, with
acc instance exec -f <file>
acc instance exec -s "context.res1 = NL.assert(NL.isEmpty([]) === true);"

AI-assistance
This π AC JS Reference is one of the foundations of the AI Adobe Campaign development lifecycle (with AGENTS.md).
Bibliography
This π AC JS Reference knowledge base was built with many iterations of βtest & learnβ, as well as the resources from: