PSScript Docs / Reference
System objects
System objects are the built-in handles whose names end in $. They bridge a script to platform services such as logging, data, workflow control, AI, messaging, finance, GIS and WorkspaceAccount security.
On this page
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.
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.
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.
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.
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.
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.
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$.remoteCall(workspaceUid, processUid, [startUid,] params)Start a process that lives in a different workspace.
workflow$.iterate(items)Starts a persisted Iteration over the given map of items. Each activation of the loop exposes the current item through param$["iteration"], param$["iterationItem"] and param$["iterationItemId"]; the iteration status is 0 for no action, 1 done, 2 failed and 3 in progress.
workflow$.text(name, locale, text)Set localized view text on the current process-component instance. The value is returned in instance load/query data under <code>texts</code>.
workflow$.meta(name, map)Store a named map as view metadata on the current process-component instance. The second argument must be a map and is returned under <code>metadata</code>.
router$
Decide which connectors may run after this step.
Permit one or more outgoing connectors to fire next.
router$.deny(connectorId, …)Block one or more outgoing connectors.
router$.forward(scope)Forwards the step to a different assignee — an account, role, group or access declaration, given as a scope string such as "SEC:WORKSPACE_REVIEWERS".
ai$
Ask a configured AI model a question with structured input.
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"].
email$
Send transactional mail.
Send an HTML email, optionally overriding the sender address.
message$
Send in-app notifications or email to accounts resolved from a security scope. When the scope is omitted, recipients come from the running process component's assigned security scope.
Send an in-app HTML notification. The optional scope may identify an Account, WorkspaceAccount, Role, Group or Access Declaration.
message$.mail(configUid, subject, html) / (securityScope, configUid, subject, html)Send email through the named Mail settings configuration to recipients resolved from the optional security scope.
blockchain$
Mint NFTs through a configured blockchain provider.
Mints an NFT from a Settings entry of class com.paradicshift.platform.settings.Blockchain. Crossmint is the provider implemented today, on Solana or Polygon. The metadata argument must be a map, and the recipient may be a bare wallet address or a provider-qualified recipient such as email:[email protected].
shell$
Run commands on a remote host over SSH.
Opens an SSH session from a Settings entry of class com.paradicshift.platform.settings.RemoteShell and returns a ShellSession handle. Host, port, username, password or RSA key, host-key fingerprint and timeout all come from that entry.
session.execute(command)Runs one command on an open session and returns its standard output. A non-zero exit status raises a script error, and the command must be 1 to 32768 bytes.
session.close()Closes the session. Always close a session you opened, ideally from a finally block so a failure part-way through still releases it.
util$
Small helpers for ids and randomness.
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].
util$.jsonToMap(json)Parses a JSON string into a map.
util$.toMap(json)Alias of jsonToMap, kept for scripts written against the earlier name.
util$.mapToJson(map)Serialises a map to a JSON string.
util$.randomInt(min, max)A random integer between min and max, inclusive.
util$.sleepMs(millis)Pauses the script for the given number of milliseconds.
util$.nowUtc()The current UTC timestamp as a string.
util$.nowMs()The current time in milliseconds since the Unix epoch.
web$
Outbound HTTP, mediated by the host.
Perform an HTTP GET and return the response body as a string.
web$.post(url, headers, bodyOrForm)Sends an HTTP POST with the given body and headers and returns the response. There is no api$ object and no context$.set method — web$ is the only outbound HTTP host.
security$
Authenticate and manage workspace-owned business users. WorkspaceAccount users belong to the workspace's custom applications and cannot sign in to ParadicShift Console or User applications.
Authenticate a WorkspaceAccount by its UN username and password. Returns the sanitized WorkspaceAccount entity on success; password hashes and other secret values are not returned.
security$.createWorkspaceAccount(entity)Create a WorkspaceAccount entity. Set UN with val, disabled with val, and the initial plaintext password as secret PWH; the platform hashes the password before persistence. Returns the created entity.
var account = PSEntity("com.paradicshift.platform.security.WorkspaceAccount");
account.val("UN", "business-user");
account.val("disabled", false);
account.secret("PWH", "initial password");
var created = security$.createWorkspaceAccount(account);Update the normal fields, maps, text and access data of an existing WorkspaceAccount. This method deliberately preserves the existing password and cannot change it.
security$.deleteWorkspaceAccount(uuid)Delete a WorkspaceAccount by UUID and revoke its active sessions.
security$.setWorkspaceAccountPassword(uuid, oldPassword, newPassword)Change a WorkspaceAccount password after verifying the old password. The new password is hashed and every existing session for the account is revoked.
Script phases
Where a script runs in a workflow component's lifecycle
Preceding script. Runs before the component is presented or executed — use it to prepare data, look up entities and seed the form.
loadScriptSourceCodeLoad script. Runs whenever the component is (re)loaded, so it may execute more than once for one instance.
postScriptSourceCodePost script. Runs after the component completes and before routing. This is the only phase in which router$ may be called; publishing rejects router$ anywhere else.
Each phase is compiled and executed on its own, and every entity operation inside one phase shares a single database transaction — a failure runs the script's rollback block. Local variables do not survive from one phase to the next; use workflow$.cache and workflow$.load to carry state between them. External calls made through web$, email$ or ai$ are not undone by a rollback.
finance$
Post double-entry accounting records from a published Financial record model
Atomically creates a Record and its RecordItems from the published MODEL_FINANCIAL_RECORD identified by recordModelUid. Values in the params map fill the model's placeholders — both its account selections and the placeholders in its description pattern. The posting is validated so total debit equals total credit, and the new record's id is returned.
gis$
Convert between WKT geometry, GeoData objects and JSON
Parses a WKT string into a GeoData object. Supported geometry families are Point, LineString, Polygon and MultiPolygon.
geoData.toJson()Serialises a GeoData object to its JSON representation.
geoData.randomPoint()Returns a random Point inside the geometry — useful for seeding test data across an area.
social$Send direct messages through a configured social platform.
Sends a message to the account whose platform ID is held in the account custom field named by the configuration's recipientFieldKey. The configuration is a Settings entry of class com.paradicshift.platform.settings.SocialMedia, and Telegram is the platform implemented today. The message must be 1 to 4096 characters.