> For the complete documentation index, see [llms.txt](https://docs.agilecase.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agilecase.com/administrator-documentation/case-type-settings/case-scripting.md).

# Case Scripting

Case types can be extended with your own scripts, which lets AgileCase do things the standard settings do not cover. This page outlines what is possible so you can judge whether it is worth pursuing. The technical guides live in the [developer documentation](/developer-documentation/case-scripting.md).

{% hint style="info" %}
Scripting is written in JavaScript. It sits outside normal system configuration and needs development experience to use safely. If you can describe what you want but would rather not write it yourself, get in touch at <sales@agilecase.com> and we can quote for building it.
{% endhint %}

## What scripting can do

There are three scripting options, each running at a different moment.

<table><thead><tr><th width="200">Option</th><th>When it runs</th><th>Typical use</th></tr></thead><tbody><tr><td><strong>JavaScript label fields</strong></td><td>While a user is looking at the tab holding the field</td><td>Calculations such as age from date of birth, dynamic dropdowns, showing and hiding fields, conditional colours</td></tr><tr><td><strong>On load scripts</strong></td><td>When a case is opened</td><td>Alerts and reminders, surfacing data buried in custom field groups onto the front of the case, adjusting the interface</td></tr><tr><td><strong>On save scripts</strong></td><td>When a case is saved</td><td>Sending an email or adding a task automatically, complex validation, updating one field based on another</td></tr></tbody></table>

Only JavaScript label fields are limited in scope: because they run in the tab that holds them, their results are not available to reports or document templates. On load and on save scripts can reach any information in the case.

## What you can do without scripting

A good deal of what people reach for scripting to achieve is already available in ordinary settings, and is easier to maintain:

* Controlling which fields and tabs users see, through [Editing Tab Visibility](/administrator-documentation/case-type-settings/editing-tab-visibility.md) and [Core Case Data Visibility](/administrator-documentation/case-type-settings/core-case-data-visibility.md)
* Server-side calculations, through the [Calculated Fields](/administrator-documentation/types-of-custom-field/calculated-fields.md) field type
* Automatic case progression, through [Creating a Case Plan](/administrator-documentation/case-type-settings/creating-a-case-plan.md)

It is worth confirming that none of these covers your requirement before taking on a script.

## Where to go next

<table data-view="cards"><thead><tr><th>Guide</th><th>What it covers</th><th data-card-target data-type="content-ref">Target</th></tr></thead><tbody><tr><td><strong>Getting Started</strong></td><td>An overview of every way AgileCase can be extended, and which to choose.</td><td><a href="/pages/AahUc9610oWqZQBOsiwC">/pages/AahUc9610oWqZQBOsiwC</a></td></tr><tr><td><strong>Case Scripting</strong></td><td>On load and on save scripts, how to add them, and worked examples.</td><td><a href="/pages/cR0aqC0vRCKtvgzj4uvp">/pages/cR0aqC0vRCKtvgzj4uvp</a></td></tr><tr><td><strong>Custom Form Scripting</strong></td><td>JavaScript label fields, for calculations and formatting within a tab.</td><td><a href="/pages/gWp151dewo9MyUBG5Qa3">/pages/gWp151dewo9MyUBG5Qa3</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.agilecase.com/administrator-documentation/case-type-settings/case-scripting.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
