> 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/developer-documentation/case-scripting/on-save-scripts/dialog-formatting-options.md).

# Dialog Formatting Options

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

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

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

<figure><img src="/files/7jYFE9SCyfPI3eMiotTJ" alt=""><figcaption></figcaption></figure>

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

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

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

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

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

This example shows the different formatting options you can use when you create feedback messages or dialogue boxes in a script.

The code snippets below are what you would use to insert each message into a script.

The first argument is always the text to display. The second argument chooses the style, and it is the part that decides whether the user sees a brief notification or a dialog box they have to dismiss.

### Notifications

These appear in the top right of the screen and fade away on their own after a few seconds. Use them for confirmation that does not need acknowledging.

| Message type             | Code                                                      |
| ------------------------ | --------------------------------------------------------- |
| **Info Notification**    | `Service.AddMessage("Info message", "notify-info")`       |
| **Success Notification** | `Service.AddMessage("Success message", "notify-success")` |
| **Warning Notification** | `Service.AddMessage("Warning message", "notify-warning")` |
| **Error Notification**   | `Service.AddMessage("Error message", "notify-error")`     |

### Dialog boxes

These open in the middle of the screen and stay until the user clicks OK. Use them when the user needs to read the message, such as when the script has refused the save.

| Message type | Code                                               |
| ------------ | -------------------------------------------------- |
| **Info**     | `Service.AddMessage("Info message", "info")`       |
| **Success**  | `Service.AddMessage("Success message", "success")` |
| **Warning**  | `Service.AddMessage("Warning message", "warn")`    |
| **Error**    | `Service.AddMessage("Error message", "error")`     |

Leaving the second argument out gives you an info dialog, so `Service.AddMessage("Info message")` is the shortest form.

A third argument sets the dialog's heading, which is otherwise "Message":

```javascript
Service.AddMessage("The rating cannot be negative", "error", "Invalid rating");
```

{% hint style="info" %}
Adding several dialog messages in one script stacks them into a single dialog box, and the heading is only used when there is just one message.
{% endhint %}


---

# 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/developer-documentation/case-scripting/on-save-scripts/dialog-formatting-options.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.
