Docs
On this page
task2 min readApplication: Platform

Run a server script

Run a one-off server script from the Server Script console to check records, test logic or fix data in bulk, and read its result and log.

Run a server script for one-off server logic. Use it to check records, test a trigger, fix records in bulk or try an integration call. Scripts use the same syntax as triggers and script libraries.

Before you begin

  • You need the administrator role.
  • A script run with writes on changes live data at once, and the change cannot be undone. Try a bulk change on a test instance first.
  • The objects a script can use are in Table and DateTime.

Steps

  1. In the Administration workspace, go to System & deployment → Diagnostics → Server script.

    The Server script item in the Diagnostics section of the System & deployment menu.
    The Server Script console with Run, the Read-only switch, Save, Assistant, and the Library, History and Examples panels.
  2. Enter the script in the editor. To start from a tested script, open Examples and pick one.

  3. Leave Read-only on to check what the script does first. In read-only mode, every write and every call to another system is refused.

  4. Select Run. To end a long run, select Stop. The script stops at its next check, or when a slow call returns.

  5. Read the Result tab for the value the script returns. Read the Log tab for anything it writes with log. Refused lists the writes and calls that read-only mode blocked.

  6. To let the script change data, select Read-only so it shows Writes on. Then select Run again. After a refused run, Allow writes and run again does both.

Result

The script has run once on the server. With writes on, the records it changed are saved straight away. Their triggers ran unless the script turned them off. The run is listed in History with its script, result and log. Runs are kept for 30 days and cannot be changed.

Variations

Save a script for later

Select Save and enter a Name, Category and Description. Turn on List in every administrator’s library to share it. Turn on Only reads data if it never writes. Saved scripts are in Library.

An unshared script is listed only in your library. This is not access control: other administrators can still open the record.

Report changes instead of making them

A script can call ConsoleRun.isReadOnly() to report what it would change instead of failing at the first write. In read-only mode, an outbound HTTP call returns status 0 instead of failing. Nothing leaves the instance.

Choose how the result is shown

By default, an object or array result is shown as JSON and anything else as text. Call ConsoleRun.setResultFormat() with text, markdown, json, xml or html to choose. Nothing in a result runs in the page.

Last updated 3 December 2026commit 6777698daac5Chris Jones
Back to top