Use this file to discover all available pages before exploring further.
A SCRIPT step runs JavaScript inside an Activity. It is the right tool when the workflow needs custom logic that is too specific for a declarative step.Script steps are commonly used to inspect documents, normalize extracted data, assign knowledge features, call Service Bridges, and decide which branch of the Activity Plan should run next.
Route the Activity based on document content, metadata, extraction results, or task status
Make several checks before deciding whether human review is needed
Update document metadata, labels, tags, data objects, or attributes
Assign knowledge features to document families
Call one or more Service Bridges and combine their responses
Emit a named action for downstream dependencies
Do not use a script just to make one external API call. Use a Service Bridge step for that so the external call has its own step status, logs, retry behavior, and result.
Activity Plan SCRIPT steps run in the server-side Goja runtime. The runtime exposes the same business objects the Activity is working on, plus helper namespaces for task state, document families, document content, Service Bridges, LLM calls, and knowledge features.
Object
Use
task
Snapshot of the Task that started the Activity, when the Activity is task-backed
families
Snapshot array of document families attached to the Task
org
Current organization { id, slug }
tasks
Query and mutate task records in the current project
documents
Query and mutate document family records in the current project
loadDocument(familyId) / documents.load(familyId)
Load a KDDB document for content nodes, tags, data objects, metadata, labels, validations, and exceptions
lookupFeature*
Find or create knowledge features for classification and routing
serviceBridge
Call project-scoped Service Bridges from custom decision logic
llm
Invoke configured LLM services with platform cost tracking
log / console
Write script logs visible from the Activity step details
The current Activity Plan script context is centered on the Task and its document families. Use prior step outputs through declarative step mappings, then pass the needed values into document metadata, task data, or downstream step configuration instead of assuming a generic inputs object exists in the script runtime.
Document changes are saved after the script completes. Modified KDDB documents are persisted as new content object versions with the SCRIPT_MODIFICATION transition type.
Sidecars are useful for shared validation functions, string cleanup, request mapping, and common routing decisions. Keep sidecars small and version them like any other project resource.