PSScript Docs / Reference

System objects

System objects are the built-in handles whose names end in $. They are the bridge between a script and the platform — logging, the data store, workflow control, AI, mail and utilities. There are twelve.

Most system objects are called with methods (obj$.method(args)). Two of them — param$ and output$ — are accessed by index instead.

context$

Execution context — logging and ambient information.

context$.log(fmt, args…)

Emit a log line. {} placeholders in fmt are replaced by the remaining arguments in order.

context$.getLocale()

Return the active locale of the running step, e.g. "en".

context$.getProcessInstanceId()

Return the identifier of the current process instance.

data$

The persistence layer — save, load, link, delete and query entities.

data$.persist(entity)

Insert or update an entity in the backing store.

data$.find(typeName, id)

Look up an entity of a given type by id; returns the entity or null.

data$.load(idOrEntity)

Load by id string, or by an entity's own id / identifier. Commonly used with a null check to "load or create".

data$.delete(entityOrId)

Remove an entity, given either the entity or its id string.

data$.link(source, target, relation)

Create a named relationship edge from one entity to another, e.g. "IN_PARENT_CATEGORY".

data$.query(PSEntityQuery)

Run a query built with PSEntityQuery and return its result. PSEntityQuery

param$ read-only

Input parameters passed into the step. Indexed, not called.

param$["key"]

Read an input value. Index chains for nested data: param$["A"]["B"]. Missing keys read as null.

output$ read / write

Values returned from the step to downstream steps. Indexed.

output$["key"] = value

Expose a value to later steps in the workflow.

output$["key"]

Read back a value previously written this run.

form$

Read and write the values of components on the step's form.

form$.val(componentId)  /  val(componentId, value)

Get a component's value, or set it when a second argument is supplied. (value is an alias of val.)

form$.text(componentId [, locale [, value]])

Get or set a component's localized text. With one argument it reads; with a locale it reads that locale; with a value it writes.

workflow$

Workflow-level state and the ability to invoke other processes.

workflow$.cache(key, value)

Store a value in the workflow-level cache, shared across steps of the same instance.

workflow$.load(key)

Read a cached value back, or null if not set.

workflow$.getInstanceId()

Return the current workflow instance id.

workflow$.call(processUid, params)  /  (processUid, startUid, params)

Start another process in the same workspace, optionally naming the start node.

workflow$.callExternal(workspaceUid, processUid, [startUid,] params)

Start a process that lives in a different workspace.

router$

Decide which connectors may run after this step.

router$.allow(connectorId, …)

Permit one or more outgoing connectors to fire next.

router$.deny(connectorId, …)

Block one or more outgoing connectors.

ai$

Ask a configured AI model a question with structured input.

ai$.ask(modelIdentifier, sessionId, inputData, question)

Send inputData (a map) and a question to a model identified by modelIdentifier, within a named session. Returns a map; common results read with e.g. result["answer"].

main$

Platform-administration actions.

main$.createWorkspace(workspaceId, workspaceName)

Provision a new workspace.

main$.createAccount(email, fullName, password)

Create a user account.

email$

Send transactional mail.

email$.send(to, subject, html)  /  (from, to, subject, html)

Send an HTML email, optionally overriding the sender address.

util$

Small helpers for ids and randomness.

util$.uuid()

Generate a random UUID string.

util$.randomString(length)

Generate a random string of the given length.

util$.randomFloat(min, max)

Return a random float in the range [min, max].

web$

Outbound HTTP, mediated by the host.

web$.get(url)

Perform an HTTP GET and return the response body as a string.

Strictly checked The parser validates object and method names at compile time. Calling an unknown system object, or a method that does not exist on it, is a compile error with the exact line:col — not a silent no-op.