> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/flow/tutorials/components/text-area/textarea-issue-with-max-length-when-clicking-on-the-next-button.md). Agents can also search and read this documentation through its [MCP server](https://docs.avonnicomponents.com/~gitbook/mcp).

# Avoid losing text when Max Length blocks Next

Keep a resolution note within Max Length so a blocked Next never cuts or empties it: stop typing at the limit, or warn the agent before Next.

A support agent closing a Case writes a long resolution note in a **Rich** mode Text Area and clicks **Next**. The note is over **Max Length**, so the screen stays, and the note comes back shorter than what the agent wrote, or empty. The way out is to keep the note from going over the limit in the first place.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FZcHe1iXaR0lIOefHTEhY%2Ftext-area-textarea-issue-with-max-length-when-clicking-on-the-next-button-before.png?alt=media" alt="Text Area after a blocked Next: the box is empty and the error says the entry is too long" width="342"><figcaption><p>A note pasted over the limit comes back empty after Next.</p></figcaption></figure>

## What the agent sees

With **Max Length** set to 300, after the blocked **Next**:

* A note typed past the limit comes back cut at exactly 300 characters.
* A note pasted in one go comes back empty.

In both cases the screen shows `Please enter a valid input. Your entry is too long.` under the box.

## Why the text is lost

The Text Area only passes a note to the flow while it meets its rules. Once the note is over **Max Length**, the flow keeps the last text that was within the limit. When **Next** is blocked, the screen shows the Text Area again with that text: the first 300 characters of a typed note, or nothing if the whole note was pasted at once. Everything past the limit is gone.

No setting on the Text Area brings that text back. What works is to stop the note before it goes over the limit.

## Before you start

* A screen flow with an **Avonni Text Area** and **Max Length** set. This page uses the API name `ResolutionNote` and a limit of 300 characters. [Limit length and show a character counter](https://docs.avonnicomponents.com/flow/tutorials/components/text-area/limit-length-and-show-a-character-counter.md) sets it up.
* Decide whether agents need formatting in the note. That decides which of the two options below fits.

## Build it

Choose how you want to build:

✨ **Build with AI**: give your AI assistant a ready-to-use prompt.

🛠️ **Build with clicks**: follow the steps in the builder yourself.

{% tabs %}
{% tab title="Build with AI" icon="wand-magic-sparkles" slug="textarea-issue-with-max-length-when-clicking-on-the-next-button-build-with-ai" %}
The `avonni-flow-components` skill drafts the change to the Text Area in your existing flow. The flow must already exist in your sandbox.

{% stepper %}
{% step %}

### Set up the Avonni Skills and MCP server

Follow [Setup](https://docs.avonnicomponents.com/flow/build-with-ai/setup.md) to install the Avonni Skills, connect your AI assistant to the Avonni MCP server, and sign in to your sandbox through Salesforce CLI.

Have the API name of your flow and of the Text Area at hand, and know whether the note needs formatting.
{% endstep %}

{% step %}

### Copy the prompt and review the plan

Paste the prompt into your configured assistant. Check the target org and the field mappings in its plan before you approve it.

{% prompt description="Prompt for this tutorial" icon="wand-magic-sparkles" openInAIProviders="false" defaultExpanded="partial" %}
{% code overflow="wrap" collapsedlinecount="10" %}

```
Use the avonni-flow-components skill. Verify the Avonni Text Area component and its property names against the Avonni MCP server before you change anything.

Inspect my sandbox and open the screen flow "Close a Case". Confirm it has an Avonni Text Area with the API name ResolutionNote and Max Length set to 300.

If the note needs no formatting, set Mode to Plain. If it needs formatting, keep Mode on Rich and turn on Show Character Count. Keep Max Length at 300 and change nothing else.

Show me the plan and the field bindings before writing files. Then draft the local metadata, list what is left to set up by hand, and stop before deployment or activation.
```

{% endcode %}
{% endprompt %}
{% endstep %}

{% step %}

### Deploy to the sandbox and check the result

Review what the assistant generated and what it left for you to configure. Deploy the approved files to your sandbox only, finish any remaining setting with the **Build with clicks** tab, then check what the agent sees at 300 characters: typing stops in **Plain** mode, the counter reads `0/300 characters remaining` and the message shows in **Rich** mode.
{% endstep %}
{% endstepper %}
{% endtab %}

{% tab title="Build with clicks" icon="screwdriver-wrench" slug="textarea-issue-with-max-length-when-clicking-on-the-next-button-build-with-clicks" %}
{% stepper %}
{% step %}

### No formatting needed: switch to Plain mode

Use this when the limit is hard, for example because the note is saved to a field that holds only 300 characters.

1. Open the screen, select the Text Area, and open the Component Builder.
2. In the **Properties** tab, set **Mode** to **Plain**.
3. Keep **Max Length** at `300`.
4. Save the Component Builder.

The box stops accepting characters at 300, so the note can never be too long and **Next** is never blocked for it. Agents lose the formatting toolbar.
{% endstep %}

{% step %}

### Formatting needed: stay in Rich mode and show the counter

**Rich** mode lets the agent keep typing past **Max Length**. Show how much room is left so the agent shortens the note before clicking **Next**.

1. In the **Properties** tab, keep **Mode** on **Rich**.
2. Turn on **Show Character Count**.
3. Save the Component Builder.

At the limit the counter stays at `0/300 characters remaining`, the border of the box turns red and `Your entry is too long.` shows under the editor, before the agent clicks **Next**.

{% hint style="warning" %}
The counter warns, it does not stop typing. If the agent clicks **Next** with a note over the limit, everything past 300 characters is lost. Tell agents to shorten the note when the message appears.
{% endhint %}
{% endstep %}

{% step %}

### Save and test

Save the flow and run it in **Debug**.

* In **Plain** mode, type past 300 characters. Typing stops and the counter, if shown, reads `0/300 characters remaining`.
* In **Rich** mode, type past 300 characters. The counter stays at `0/300 characters remaining` and `Your entry is too long.` appears under the editor. Shorten the note until the message goes away, then click **Next**: the flow moves on.
  {% endstep %}
  {% endstepper %}
  {% endtab %}
  {% endtabs %}

## Troubleshooting

<details>

<summary>I mapped Value to the component's own output and turned on Refresh inputs, and the text is still lost</summary>

An earlier version of this page suggested that setup. It does not bring the text back: the flow only ever receives the last note that met **Max Length**, so that is all it can show again. You can remove it, and use Plain mode or the counter as described above.

</details>

## Related tutorials

* [Limit length and show a character counter](https://docs.avonnicomponents.com/flow/tutorials/components/text-area/limit-length-and-show-a-character-counter.md): set **Max Length**, **Min length** and the counter, and compare the two modes at the limit.
* [Require a note and block words](https://docs.avonnicomponents.com/flow/tutorials/components/text-area/require-a-note-and-block-words.md): the other rules that can block Next.
* [Choose the toolbar](https://docs.avonnicomponents.com/flow/tutorials/components/text-area/choose-the-toolbar.md): what agents keep in **Rich** mode, and what they give up in **Plain** mode.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avonnicomponents.com/flow/tutorials/components/text-area/textarea-issue-with-max-length-when-clicking-on-the-next-button.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
