> 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/interactions/how-to-create-an-interaction-to-navigate-to-an-object.md).

# Add a New Opportunity button that opens a prefilled record form

Add a New Opportunity button to a Data Table that opens the standard new record form with Stage and Type already filled in, so reps skip retyping defaults.

A sales rep works through their open pipeline on a flow screen and spots a new deal. A **New Opportunity** button in the table header opens the standard new record form, with **Stage** already set to `Prospecting` and **Type** to `New Business`. The rep fills in the name, account and amount, and saves.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2Fme7jKdpngdehCfFpPHdl%2Fnavigate-how-to-create-an-interaction-to-navigate-to-an-object-result.png?alt=media" alt="New Opportunity form opened from the Data Table with Stage set to Prospecting"><figcaption><p>The form opens with Stage already filled in.</p></figcaption></figure>

## Before you start

* A screen flow with an Avonni Data Table of open Opportunities. [Creating Row Actions](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/creating-row-actions.md) builds the same table with its row actions.
* The API names of the fields to prefill, here `StageName` and `Type`. The values must exist in the picklists, and each field must be on the page layout of the record type the form opens with.

## Steps

{% stepper %}
{% step %}

### Add the header button

1. Select the Data Table and click **Open Component Builder**.
2. In the **Properties** tab, open the **Header** group.
3. Under **Actions**, add an item: **Label** `New Opportunity`, **Name** `new_opportunity`.

The button appears above the table.
{% endstep %}

{% step %}

### Point a Navigate interaction at the New action

1. Open the **Interactions** tab and add a **Header Action** interaction.
2. In **Target Name**, pick **New Opportunity**, and set **Type** to **Navigate**.
3. Set **Page Reference Type** to **Object Page**, **Object Api Name** to `Opportunity` and **Action Name** to **New**. Leave **Target** on **Current Window**.

**Prefilled Values** and **Use Record Type Check** only appear once **Action Name** is **New**. The other actions, **Home** and **List**, open the object's home page or a list view.
{% endstep %}

{% step %}

### Prefill the fields

Under **Prefilled Values**, add one item per field:

* **Field** **Stage**, **Value** `Prospecting`.
* **Field** **Opportunity Type**, **Value** `New Business`.

**Field** is a picker of the object's fields, so pick the field rather than typing it. **Value** is plain text: type the value the way the field stores it.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2F7ePpVWbKA1i8SuWKChJm%2Fnavigate-how-to-create-an-interaction-to-navigate-to-an-object-interaction.png?alt=media" alt="Header Action interaction set to Navigate, Object Page, action New, with two prefilled values" width="320"><figcaption><p>Prefilled Values and Use Record Type Check appear once Action Name is New.</p></figcaption></figure>
{% endstep %}

{% step %}

### Let the rep pick a record type

Turn on **Use Record Type Check** when Opportunity has several record types. The rep then chooses the record type before the form opens. Leave it off and the form opens with the rep's default record type.

Every field of the interaction is listed in [Navigate: Object Page](https://docs.avonnicomponents.com/flow/component-builder/interactions-panel/navigate.md#object-page).
{% endstep %}

{% step %}

### Save and test

Click **Done**, save the flow and run it. Click **New Opportunity** above the table: the new Opportunity form opens with **Stage** set to **Prospecting**, and **Type** set to **New Business** if the record type's page layout shows the Type field. A prefilled field that is not on the layout is not shown on the form. The rep completes the other fields and clicks **Save**.
{% endstep %}
{% endstepper %}

## Troubleshooting

<details>

<summary>The form opens but a field is empty</summary>

The **Value** does not match a value the field accepts. For a picklist, type the API value of the entry, not a translated label. Check also the spelling of the value, including its case.

</details>

<details>

<summary>New Opportunity is missing from Target Name</summary>

**Target Name** lists the header actions that have a **Name**. Open the **Header** group, select the action under **Actions** and fill **Name**.

</details>

## Related tutorials

* [Open a record from a Data Table row](https://docs.avonnicomponents.com/flow/tutorials/interactions/how-to-create-an-interaction-to-a-record-page.md): View, Edit and Clone a record from its row.
* [Send users to an external site or another Lightning page](https://docs.avonnicomponents.com/flow/tutorials/interactions/send-users-to-an-external-site-or-another-lightning-page.md): link a header button to a website or an app tab.
* [Passing multiple record IDs to another flow](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/tips-and-tricks/passing-multiple-record-ids-to-another-flow.md): a header action that opens a second flow on the ticked rows.


---

# 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/interactions/how-to-create-an-interaction-to-navigate-to-an-object.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.
