---
title: "Run a server script"
site: admin
version: 2027.1
versions: "all"
url: https://docs-new.servicely.ai/admin/2027.1/automation/scripts/run-a-server-script/
type: task
application: platform
last_updated: 2026-12-03
commit: 6777698daac5
---


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](page:api/scripting/records/table) and [DateTime](page:api/scripting/dates-and-numbers/datetime).

## Steps

<Steps>
  <Step>
    In the Administration workspace, go to **System & deployment → Diagnostics → Server script**.

    <Image src="asset:screenshots/admin/automation-scripts-run-a-server-script/server-script-menu.png">The Server script item in the Diagnostics section of the System & deployment menu.</Image>

    <Image src="asset:screenshots/admin/automation-scripts-run-a-server-script/server-script-console.png" size="90">The Server Script console with Run, the Read-only switch, Save, Assistant, and the Library, History and Examples panels.</Image>
  </Step>
  <Step>
    Enter the script in the editor. To start from a tested script, open **Examples** and pick one.
  </Step>
  <Step>
    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.
  </Step>
  <Step>
    Select **Run**. To end a long run, select **Stop**. The script stops at its next check, or when a slow call returns.
  </Step>
  <Step>
    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.
  </Step>
  <Step>
    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.
  </Step>
</Steps>

## 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.

## Related

- [Where scripts run](page:automation/scripts/where-scripts-run)
- [Triggers](page:automation/scripts/triggers)
- [Script libraries](page:automation/scripts/script-libraries)
- [TableProtected and TableChecks](page:api/scripting/records/table-checks)
