> 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/types-of-custom-field/calculated-fields.md).

# Calculated Fields

The calculated field type allows you to enter your own JavaScript commands that are stored and calculated on the server.

<figure><img src="/files/Yy0oJ3AH53cxjO2Ry5Mf" alt=""><figcaption></figcaption></figure>

Rather than being "static" and stored in the database, these values are calculated in real-time and can be used to populate document templates with real-time information.

An example could be the calculation of UK VAT on a purchase. Whenever the case is loaded, the value of the custom field will be calculated server-side and a figure returned with the UK VAT amount added.

As with other scripting features, JavaScript is the syntax used. At its simplest, a user could enter a command like this:

```javascript
function calc() {Case.CustomField("Purchase Price") * 1.2;}
```

This would generate the UK VAT calculation field entered in the example.

{% hint style="info" %}
On the front-end, this field type is read only, so it cannot be edited directly by users.
{% endhint %}

Writing the calculation itself is a development task. For worked examples and the wider scripting reference, see the [developer documentation](/developer-documentation/developer-documentation.md).


---

# 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/types-of-custom-field/calculated-fields.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.
