---
title: "Where scripts run"
site: admin
version: 1.11
versions: "all"
url: https://docs-new.servicely.ai/admin/1.11/automation/scripting-overview/
type: concept
application: platform
last_updated: 2026-10-18
commit: f37120b6b82b
---


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.

| Script | Runs on | Configured in |
| --- | --- | --- |
| Trigger | Server | **Administration → Business Logic → Triggers** |
| Script library | Server | **Administration → Business Logic → Script library** |
| System event script | Server | **Administration → Event configuration → System event script** |
| System configuration script | Server | **Administration → Business Logic → System configuration scripts** |
| Server script | Server | **Administration → Administrator tools → Server script** |
| Workflow activity scripts | Server | The workflow editor |
| Table operation server script | Server | **Administration → Business Logic → Table operations** |
| Generator, field map and SLA scripts | Server | The record generator, reminder generator, reclassification field map and SLA definition records |
| UI event | Client | **Administration → Business Logic → UI event** |
| Table operation client script, Before, On success and On failure | Client | **Administration → Business Logic → 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` |

## 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/table). |
| `user` | The signed-in user. See [user and User](page:api/scripting/user). |
| `log` and `Logger` | Write to the system log. |
| `DateTime`, `ScheduleManager`, `RangeGenerator` | Dates, durations and schedules. See [DateTime](page:api/scripting/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/triggers)
- [UI events](page:automation/ui-events)
- [Script libraries](page:automation/script-libraries)
- [Run a server script](page:automation/run-a-server-script)
- [Table](page:api/scripting/table)
