> 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/release-notes/2025/june-2025.md).

# June 2025

## 18 June 2025

A short follow-up to the AI Templates release, adding the pieces that came out of putting them to work on real cases.

### New

#### Passing extra instructions into an AI Template

An AI template can now include a `{{AI.ExtraPromptText}}` placeholder anywhere in its body. Whatever your script passes as the fifth argument to `Service.AIAction` is substituted in its place.

```javascript
var reply = Service.AIAction(
    "Draft Client Update",
    null,
    0,
    null,
    "Keep it to three sentences and do not mention fees.");
```

This lets one template serve several situations, with the script deciding the specifics, instead of maintaining a near-identical template for each variation. The placeholder is matched regardless of capitalisation, and works in both text and Word-based AI templates.

#### Two new scripting functions

Two date helpers are now available in on save scripting:

| Function                       | What it returns                            |
| ------------------------------ | ------------------------------------------ |
| `Service.DateDiff(start, end)` | The number of whole days between two dates |
| `Service.GetCurrentDate()`     | Today's date as `YYYY-MM-DD`               |

`Service.DateDiff` flags any value it cannot read as a date, so the number you get back is always one you can rely on.

Together these make deadline and age calculations straightforward:

```javascript
var daysToDeadline = Service.DateDiff(Service.GetCurrentDate(), Service.CustomField("1234").Value);
if (daysToDeadline < 14) {
    Service.AddTask("Deadline approaching", "Check the file before the deadline", Service.Case.FeeEarner, 7);
}
```

Both are documented in the [Script API Reference](/developer-documentation/case-scripting/on-save-scripts/script-api-reference.md), along with the rest of the scripting API.

### Improved

#### Microsoft 365 naming in the document viewer

Microsoft has retired the Office Online branding, so the document viewer now refers to **Microsoft 365** where it previously said Office Online. The behaviour is unchanged — only the wording is different.

***

## 8 June 2025

The headline of this release is **AI Templates**: a way of writing a prompt once, as a template, and calling it from your case scripting with the case's own data filled in.

### New

#### AI Templates

A new **AI Templates** option appears under **Settings → Templates**. An AI template is written in the same way as an email template, so everything you already know about merge fields applies — anything you can put in an email template you can put in a prompt.

When the template runs, AgileCase fills in the merge fields for the case in question and sends the result to the AI service as the instruction. Whatever comes back is handed straight to your script.

You call a template from an **On Save** script:

```javascript
var summary = Service.AIAction("Summarise Case Position");
Service.UpdateCustomField("4321", summary);
```

The full set of arguments is:

```javascript
Service.AIAction(templateName, input, documentId, type)
```

| Argument       | What it is                                                 |
| -------------- | ---------------------------------------------------------- |
| `templateName` | The name of the AI template to run                         |
| `input`        | Text to send alongside the template, such as a field value |
| `documentId`   | The ID of a document on the case to include                |
| `type`         | How a document should be sent — see below                  |

#### Working with documents

Passing a `documentId` lets a template work on a document held against the case, rather than only on field values.

Word documents, and plain text, HTML and JSON files, are read and sent as text. PDFs can be sent in three ways, chosen with the `type` argument:

| `type`            | What happens                                                            |
| ----------------- | ----------------------------------------------------------------------- |
| `AsBase64Encoded` | The PDF is sent as a file. This is the default                          |
| `AsURL`           | A short-lived share link is created and the AI service fetches the file |
| `AsHTML`          | The PDF is converted to HTML first, then sent as text                   |

Sending PDFs as files or as a link, rather than converting them, means larger documents can be processed without the loss of layout that conversion involves.

#### Emailing the result

An AI result can be sent straight out as an email from the same script. Use `{{AI.Output}}` in the body of the email template where the result should appear, and AgileCase substitutes it when the email is built. `{{AI.Input}}` is available as an alias for the same value, and both are matched regardless of capitalisation.

See [Sending an Email Upon Saving a Case](/developer-documentation/case-scripting/on-save-scripts/examples/sending-an-email-upon-saving-a-case.md) for the sending side of this, and [Running an AI Action on a Document](/developer-documentation/case-scripting/on-save-scripts/examples/running-an-ai-action-on-a-document.md) for a worked example.

#### Every interaction is recorded on the case

Each call is written to the case as a private communication of type **AI Interaction**, showing the prompt that was sent and the answer that came back.

Where the service returns something other than an answer, its response is recorded on the same entry, so there is always a complete record of the exchange to refer back to.

#### While an AI template is running

A call to an AI service takes a few seconds. The case screen now holds while a script waits for its result, so a save is only ever submitted once.

### Improved

#### Selectable rows in Word-based email templates

Emails built from a Word document template that uses **Selectable Rows** now merge the **To**, **CC**, **BCC** and **Subject** lines along with the body, so the whole message arrives fully populated.

There is more on this style of template in [Creating a Template with Selectable Rows](/administrator-documentation/templates/creating-a-template-with-selectable-rows.md).

#### Call notes opened from a list

Opening a call note from a list now always shows the entry you picked.

### Worth knowing

The AI service, model and its settings are configured for your account by us rather than in the interface. If you would like AI Templates enabled, or want to discuss which model suits your work, get in touch at <support@agilecase.com>.


---

# 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/release-notes/2025/june-2025.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.
