Adobe Campaign Classic Developer Expert study materials
Adobe Campaign Classic Developer Expert study resources

Adobe Campaign Classic Developer Expert: JavaScript and SQL in Adobe Campaign

Adobe Campaign Classic Developer Expert · Work through your exam, one topic at a time.

All guide sections

JavaScript and SQL in Adobe Campaign

JavaScript and SQL in Adobe Campaign

Server-side JavaScript runs in workflows, web applications, JSSP pages, and delivery content. The main APIs are xtk.queryDef, xtk.session, xtk.workflow, application, logInfo, logWarning, getOption, and setOption. Learn variable scopes: instance.vars is instance-wide, vars is workflow or context scope, task.vars belongs to an activity, and targetData is the delivery target. queryDef.create() with select() and where() builds schema-aware queries; Get and Write methods retrieve and persist records. These APIs return XML objects, not plain arrays, so convert deliberately.

SQL activities use Adobe Campaign SQL syntax. sqlExec runs a statement, sqlSelect returns rows, and sqlGetInt returns a scalar. They bypass schema security and validation, so never concatenate untrusted input. In SQL activities, DECLARE defines variables and SELECT ... INTO assigns them. The $(...) syntax substitutes workflow variables into SQL, filenames, and URLs; it is not JavaScript evaluation.

Traps and rule of thumb

console.log is not available server-side; use logInfo. Delivery JavaScript executes during preparation and send, not when the workflow is designed. Workflow code runs once per activity execution, so iterate explicitly if you need row-level logic. SQL injection questions often hide in “internal” tools.

Worked example: var batch = getOption('NmsDelivery_DefaultBatchSize'); logInfo('Batch size: ' + batch); reads a platform option safely. Rule: use schema APIs for business data and reserve SQL for set-based operations, reporting, and debugging.