---
title: "Where scripts run"
site: admin
version: 2027.1
versions: "all"
url: https://docs-new.servicely.ai/admin/2027.1/automation/scripts/where-scripts-run/
type: concept
application: platform
last_updated: 2026-12-03
commit: 6777698daac5
---


Servicely runs JavaScript in two places: on the Servicely server and in the user's browser. This page tells administrators and developers where each kind of script runs and which variables it receives, so you write each script against the right objects.

## Server and client

A server script runs on the Servicely server with access to every table through the `Table` API. It runs whether or not a user has the record open. A client script runs in the user's browser while a form or list is open. It can change what the user sees, but it reaches server data only through a controller or a REST call.

<Callout type="info">
  **Changed in 2027.1.** The Server Script console opens read-only. Before and Before workflow triggers can refuse a save with `Refusal.refuse`. The jQuery UI and Dropzone libraries were removed from the browser.
</Callout>

The menu paths below are in the Administration workspace.

| Script | Runs on | Configured in |
| --- | --- | --- |
| Trigger | Server | **Scripting & automation → Scripts → Triggers** |
| Script library | Server | **Scripting & automation → Scripts → Script library** |
| System event script | Server | **Scripting & automation → Events → System event script** |
| System configuration script | Server | **Scripting & automation → Scripts → System configuration scripts** |
| Server script | Server | **System & deployment → Diagnostics → Server script** |
| Workflow step scripts | Server | The workflow designer |
| Table operation server script | Server | **Scripting & automation → Scripts → Table operations** |
| Generator, field map and SLA scripts | Server | The record generator, reminder generator, reclassification field map and SLA definition records |
| UI event | Client | **Scripting & automation → Scripts → UI event** |
| Table operation client script, Before, On success and On failure | Client | **Scripting & automation → Scripts → Table operations** |

## Variables each script receives

Each kind of script gets the record it acts on and a few variables of its own.

| Script | Variables |
| --- | --- |
| Trigger | `current`, `previous` (the record before the change) and `operation` (`create`, `update` or `delete`) |
| UI event | `current`, `viewAspect` and `isLoading` |
| Table operation condition | `current`, `viewAspect` and `tableName`. On the client also `formContext` and `formType`. |
| Table operation On success | `response`, which holds the `answer` the server script set |
| Workflow activity | `current`, `context`, `log`, `action` and `ActivityOptions` |
| System event script | `event` (the system event record) and `current` (the record it names) |
| Reclassification field map | `sourceRec`, `sourceTable`, `targetRec` and `targetTable` |
| SLA definition update script | `current`, `slaRec`, `slaDefinitionRec` and `operation` |

In a trigger, `current` is a TableRecord. Read and set its fields, save it and test what changed with the methods on [TableRecord](page:api/scripting/records/table-record). To find other records from a server script, see [Querying tables](page:api/scripting/querying-tables). Both pages are in the Scripting reference under **Develop**, which has one page per object.

## Conditions and the answer variable

A script used as a condition or a calculation returns its result in one of two ways. Most set a variable named `answer`, for example `answer = [current.Assignee().getID()];` in a reminder generator. Some use the value of the last expression, as the **Business logic** script of an approval does. A client condition on a table operation is wrapped in a function, so it uses `return`. Each field's page says which form it expects.

## Globals

Server scripts can use platform globals without importing them. The ones the pages in this section use most are:

| Global | Use |
| --- | --- |
| `Table` | Query, create, update and delete records. See [Table](page:api/scripting/records/table). |
| `user` | The signed-in user. See [user and User](page:api/scripting/platform/user). |
| `log` and `Logger` | Write to the system log. |
| `Refusal` | Refuse a save from a Before or Before workflow trigger. See [Triggers](page:automation/scripts/triggers). |
| `DateTime`, `ScheduleManager`, `RangeGenerator` | Dates, durations and schedules. See [DateTime](page:api/scripting/dates-and-numbers/datetime). |
| `Workflow` | Move a record through its workflow. |
| `ApplicationPropertyManager` | Read application properties. |
| `SystemEvent`, `Scheduler`, `TableChecks` | Process events, schedule work and control the checks a save runs. |

A script library is also a global. Once it is active, server scripts call it by name, for example `IncidentUtil.getIncidentOpenTasks(current)`. A reclassification field map script loads one with `require("WorkflowUtil")`.

Client scripts use the client globals instead: `current` from the [Client form API](page:api/scripting/client-form-api), `WS.controller()` to call a system controller, `REST` to call the REST API, and `Navigate` and `DialogAPI` in table operations.

## Related

- [Triggers](page:automation/scripts/triggers)
- [UI events](page:automation/scripts/ui-events)
- [Script libraries](page:automation/scripts/script-libraries)
- [Run a server script](page:automation/scripts/run-a-server-script)
- [Table](page:api/scripting/records/table)
