> For the complete documentation index, see [llms.txt](https://docs.valorx.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.valorx.com/valorx-wave/surf-the-wave/publish-the-grid/salesforce-components.md).

# Salesforce Components

You can add a **Valorx Grid** to Salesforce components and Screen Flows so users can view and work with Salesforce data without leaving their current Salesforce experience.

You can use a Valorx Grid in:

* **Aura Components** for custom Salesforce components.
* **Screen Flows** for guided Salesforce processes.
* **Lightning Web Components (LWC)** when you need more control over how the Grid is configured and used.

You can add either a **Valorx Grid** or a **Valorx Related Grid**, depending on the data you want to display.

#### Which option should I use?

<table><thead><tr><th width="469">If you want to...</th><th>Use</th></tr></thead><tbody><tr><td>Add a Grid to a custom Salesforce component</td><td><strong>Aura Component</strong></td></tr><tr><td>Add a Grid to a guided Salesforce process</td><td><strong>Screen Flow</strong></td></tr><tr><td>Build a custom Salesforce component and control the Grid through code</td><td><strong>Lightning Web Component (LWC)</strong></td></tr></tbody></table>

> **Note:** The LWC option requires Salesforce development knowledge. If you are using a Screen Flow, you can add a Valorx Grid without creating an LWC.

#### Before you begin

Before you start, make sure you have:

* A Valorx Grid that you want to add to Salesforce.
* The **Grid ID** for the Grid.
* The Salesforce access required to add or configure the component or Flow.

Don't know where to find it? See [Get Grid ID](#get-grid-id).

***

## Use Valorx Grid in an Aura Component

You can embed a **Valorx Grid** or **Valorx Related Grid** in an Aura Component.

Use this option when your Salesforce team is building a custom Aura Component and wants users to work with Grid data directly from that component.

Before you begin, make sure you:

* Are familiar with **Lightning Components (Aura Components)**.
* Have already created the Valorx Grid you want to use.

#### What is the difference between the two Grid types?

**Valorx Grid**\
Displays records from the object selected for the Grid. For example, you can display a Grid containing Account records.

**Valorx Related Grid**\
Displays records related to the record the user is currently viewing. For example, you can display Contacts related to the current Account.

This guide demonstrates how to configure both **Valorx Grid** and **Valorx Related Grid** within a Lightning Component.

{% stepper %}
{% step %}

#### Create the Lightning Component

1. In Salesforce, click **Setup** and open the **Developer Console**.
2. In the Developer Console, click **File** > **New** > **Lightning Component**.
3. Enter a component name, such as `MyGridComponent`.
4. Select the component availability based on your requirements.
5. Click **Submit**.

**If you are using a Valorx Related Grid**

A Related Grid needs the ID of the parent record so it knows which records to display. Define the **Parent Record ID** as a parameter by adding the following code to your component:

{% code overflow="wrap" expandable="true" %}

```json
<aura:component 
implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global">
    <aura:attribute name="recordId" type="String" />
</aura:component>
```

{% endcode %}

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FJc4L653AYkevLX9XHUNX%2FCreate%20the%20Lightning%20Component%20P1.gif?alt=media&amp;token=343311a3-af04-46ba-b901-8a98ac20d550" alt=""><figcaption><p>Create the Lightning Component</p></figcaption></figure>
{% endstep %}

{% step %}

#### Add the  Valorx Grid and Related Grid

Use `lightning:tabset` to display the Valorx Grid and Related Grid.

The following example shows both types of Grid:

{% code overflow="wrap" fullWidth="false" expandable="true" %}

```json
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global">
    <aura:attribute name="recordId" type="String" /> 
    <div style="background:white;">
        <lightning:tabset selectedTabId="one"> 
            <lightning:tab label="Enter_the_Tab_Name" id="one"> 
                <valorxwave:ValorxRapidGrid  
                    gridId="Account::Insert_The_Id" 
                    height="600" 
                    canChangeGrid ="true"/> 
            </lightning:tab> 
            <lightning:tab label="Enter_the_Tab_Name" id="two"> 
                <valorxwave:ValorxRelatedRapidGrid  
                    gridId="Contact::Insert_The_Id"  
                    recordId="{!v.recordId}"  
                    relationshipName='Insert_The_Relationship_Name' 
                    height="600"  
                    canChangeGrid ="true"/> 
            </lightning:tab> 
        </lightning:tabset> 
    </div>
</aura:component>
```

{% endcode %}

#### Configure the Grid

<table><thead><tr><th width="177">Parameter</th><th>What it does</th></tr></thead><tbody><tr><td><strong>Grid ID</strong></td><td>Identifies the Grid you want to display. Use the format <code>ObjectName::GridId</code>.</td></tr><tr><td><strong>height</strong></td><td>Sets the height of the Grid.</td></tr><tr><td><strong>canChangeGrid</strong></td><td>Allows users to switch between Grids for the same object when enabled.</td></tr><tr><td><strong>relationshipName</strong></td><td>Specifies the Lookup Relation Name for a Related Grid.</td></tr><tr><td><strong>recordId</strong></td><td>Specifies the Parent Record ID for a Related Grid.</td></tr></tbody></table>

For information about finding the Grid ID, see [Get Grid ID](#get-grid-id).

> **Important:** Save the component after configuring the parameters so that your changes take effect.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FL4YPtiGB5l5Tnv56IiZ5%2FCreate%20the%20Lightning%20Component%20P2.gif?alt=media&amp;token=fcf3a7ba-62d1-454e-a13e-af1c7b5b1871" alt=""><figcaption><p>Add Valorx Grid and Related Grid</p></figcaption></figure>
{% endstep %}

{% step %}

#### Add the Component to a Record Page

After creating and configuring the component, add it to the Salesforce Record Page.

1. Navigate to the **Account Record Page** and click **Edit Page**.
2. In the **Custom Components** section, find **MyGridComponent**.
3. Drag **MyGridComponent** to the section where you want the Grid to appear.
4. Click **Save**.
5. Return to the Record Page and verify that the Grid is displayed.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FdOpYAUrwy5M8hDLqFeS6%2FCreate%20the%20Lightning%20Component%20P3.gif?alt=media&amp;token=242b84ba-0f10-4e86-a441-656190802666" alt=""><figcaption><p>Deploy the Component on a Record Page</p></figcaption></figure>
{% endstep %}
{% endstepper %}

Your Valorx Grid is now available in the Aura Component.

***

## Use Valorx Grid in a Screen Flow

{% hint style="info" %}
Available in Valorx Wave v10 and later.
{% endhint %}

You can add a **Valorx Grid** or **Valorx Related Grid** to a Salesforce **Screen Flow**. This allows users to work with Grid data as part of a guided Salesforce process.

{% stepper %}
{% step %}

#### Create a New Flow

* Click **Setup** and search for **Flow** in the **Quick Find** box.
* Click **New Flow** → Select **Start from Scratch** → Select **Screen Flow** → Click **Create**.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2Fadk0tPsT8uJIEQFLnuM6%2FCreate%20a%20Flow.gif?alt=media&amp;token=3995ec8f-d7ae-4e4f-b9d9-fe4690bb04fd" alt=""><figcaption><p>Create a new Flow</p></figcaption></figure>
{% endstep %}

{% step %}

#### Add a Screen

* Drag a **Screen** element from the **Element** panel to the Flow canvas.

  You can also click the **+** button and select **Screen**.
* Enter a **Screen Component Label**, such as `Valorx Grid`.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FvqZPT7OqcfWhL5xBUpS2%2FAdd%20A%20Screen%20Flow.gif?alt=media&amp;token=6213b136-3f5d-4226-a413-ac84fbff323a" alt=""><figcaption><p>Add a Screen Flow</p></figcaption></figure>
{% endstep %}

{% step %}

#### Add a Valorx Grid

1. In the left panel, scroll to **Components**.
2. Find the **Custom** section.
3. Drag the **Valorx Grid component** onto the Screen.
4. Configure the following properties:

<table><thead><tr><th width="202">Property</th><th>What it does</th></tr></thead><tbody><tr><td><strong>API Name</strong></td><td>Specifies the component's API name.</td></tr><tr><td><strong>Grid ID</strong></td><td>Identifies the Grid you want to display. Use the format <code>ObjectName::GridId</code>.</td></tr><tr><td><strong>Height</strong></td><td>Sets the height of the Grid.</td></tr><tr><td><strong>Allow Changing Grids</strong></td><td>Allows users to switch between Grids for the same object when enabled.</td></tr></tbody></table>

For information about finding the Grid ID, see [Get Grid ID](#get-grid-id).

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FzIlBUNN2iU4iWMhH3NQ4%2FAdd%20Valorx%20Grid.gif?alt=media&amp;token=5afe9d42-af14-4b74-a5d4-5ff7d2294b92" alt=""><figcaption><p>Embed Valorx Grid in the Screen Flow</p></figcaption></figure>
{% endstep %}

{% step %}

#### Add a Valorx Related Grid

You can also add a Related Grid to the same Screen.

1. Follow the same steps to add the **Related Grid component** below the Valorx Grid.
2. Configure the following properties:

<table><thead><tr><th width="200">Property</th><th>What it does</th></tr></thead><tbody><tr><td><strong>Grid ID</strong></td><td>Identifies the Related Grid you want to display.</td></tr><tr><td><strong>Height</strong></td><td>Sets the height of the Related Grid.</td></tr><tr><td><strong>Allow Changing Grids</strong></td><td>Allows users to switch between Grids for the same object when enabled.</td></tr><tr><td><strong>Relationship Name</strong></td><td>Specifies the Lookup Relation Name used to connect the related records to the parent record.</td></tr><tr><td><strong>Record ID</strong></td><td>Specifies the Parent Record ID.</td></tr></tbody></table>

For information about finding the Grid ID, see [Get Grid ID](#get-grid-id).

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2F7y2thveXpSaVeYmMuAJ4%2FAdd%20Valorx%20Related%20Grid.gif?alt=media&amp;token=f71b12a0-4ffb-4bc4-9872-293c7196fdf8" alt=""><figcaption><p>Embed Valorx Related Grid in Screen Flow</p></figcaption></figure>
{% endstep %}

{% step %}

#### Save and Activate the Flow

* Click **Done** → Click **Save** and provide a **Flow Label**.
* Click **Activate** to enable the Flow.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FIkpdAoSsNVIQt7fgPNQH%2FSave%20and%20Activate%20the%20flow.gif?alt=media&amp;token=db5494a4-3403-4906-86b3-c6c9e853f2de" alt=""><figcaption><p>Save and Activate the Flow</p></figcaption></figure>
{% endstep %}
{% endstepper %}

Your Screen Flow is now ready to use the Valorx Grid.

### Add an Input Variable in Flow

Use an input variable when you need to pass a record ID into a Salesforce Flow.

To add an **Input Variable** in Flow:

1. In Flow Builder, click **+ New Resource**.
2. Set **Resource Type** to **Variable**.
3. Enter `recordId` as the **API Name**.
4. Set **Data Type** to **Text**.
5. Select **Available for Input**.
6. Click **Done**.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2Fg5lIBL6nN4escBReGDlK%2FCreate%20RecordId.gif?alt=media&amp;token=8088a0e1-7fc2-434f-a488-940ca3272e4d" alt=""><figcaption><p>Add an Input Variable in Flow</p></figcaption></figure>

***

## Use Valorx Grid in a Lightning Web Component (LWC)

You can add a **Valorx Grid** or **Valorx Related Grid** to your own Lightning Web Component (LWC) and place it on a Salesforce App Page, Record Page, or Home Page.

This guide shows you how to:

* Add a Valorx Grid to your LWC.
* Configure the Grid.
* Deploy the component to Salesforce.
* Optionally pass records to the Grid, display related records, or read records selected by users.

{% hint style="info" %}
**Availability:** LWC support is available in Valorx Wave v22 and later.
{% endhint %}

### Before you begin

Make sure the following requirements are met in your Salesforce org:

<table><thead><tr><th width="203">Requirement</th><th>Details</th></tr></thead><tbody><tr><td><strong>Valorx Wave package</strong></td><td>The Valorx Wave managed package must be installed.</td></tr><tr><td><strong>User permission</strong></td><td>Assign <strong>Vx Grid Runtime User</strong> to users who need to use the Grid. If they also build Grids, assign <strong>Vx Grid Design Studio User</strong>.</td></tr><tr><td><strong>Experience Cloud users</strong></td><td>Assign <strong>Valorx Grid Runtime User for Experience Cloud</strong> to users accessing the Grid through Experience Cloud.</td></tr><tr><td><strong>Salesforce API version</strong></td><td>Your LWC must use Salesforce API version <strong>55.0 or later</strong>.</td></tr></tbody></table>

The Grid checks the user's permissions before it loads. If the user does not have the required permission, an **Insufficient Permission** message is displayed instead of the Grid.

{% hint style="info" %}
You also need the **Grid ID** of the Grid you want to display.&#x20;

Keep the Grid ID ready. You will add it to your LWC in the next step.\
For more information, see [Get Grid ID](#get-grid-id).
{% endhint %}

{% stepper %}
{% step %}

#### Create the wrapper component

Create a standard Lightning Web Component in your Salesforce project.

For this example, we'll call the component `myGridWrapper`.

Your component contains three files:

```
myGridWrapper/
├── myGridWrapper.js
├── myGridWrapper.html
└── myGridWrapper.js-meta.xml
```

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FrVYqRrtJBgRFcOCgsvj4%2FCreate%20the%20wrapper%20component.gif?alt=media&amp;token=64cb67e4-ced5-4251-bd0b-84801eab8435" alt=""><figcaption><p>Create the wrapper component</p></figcaption></figure>

You will configure each file in the following steps.
{% endstep %}

{% step %}

#### Add the Valorx Grid to the HTML file

Open `myGridWrapper.html` and add the following code:

{% code title="myGridWrapper.html" overflow="wrap" %}

```html
<template>
    <div class="grid-host">
        <valorxwave-valorx-grid
            grid-id={gridId}
            height={height}
            can-change-grid={canChangeGrid}
            record-id={recordId}
            relationship-name={relationshipName}
            external-variables={externalVariables}
            input-records={inputRecords}
            grid-config={gridConfig}>
        </valorxwave-valorx-grid>
    </div>
</template>
```

{% endcode %}

This adds the packaged Valorx Grid to your LWC.

The values in `{ }` connect the Grid attributes to properties in your JavaScript file.

For example: `grid-id={gridId}` connects the Grid's `grid-id` attribute to the `gridId` property in your JavaScript file.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FLNfZPKjpKMVVSQapXIPP%2FAdd%20the%20Valorx%20Grid%20to%20the%20HTML%20file.gif?alt=media&amp;token=13ab3d9c-f5b7-434e-9372-3416d75c8856" alt=""><figcaption><p>Add the Valorx Grid to the HTML file</p></figcaption></figure>
{% endstep %}

{% step %}

#### Configure the Grid in the JavaScript File

This file defines the values used by the Grid and sets up the listener that captures the user's Grid selection. Open `myGridWrapper.js` and add the following code:

{% code title="myGridWrapper.js" overflow="wrap" %}

```js
import { LightningElement, api } from 'lwc';
 
export default class MyGridWrapper extends LightningElement {
    @api recordId;                 // supplied by a record page, or set it yourself
 
    gridId = 'Account::a0X5g000004ABCDEAO'; //update this to your Grid ID
    height = 700;                  // px; minimum 600
    canChangeGrid = false;
    relationshipName;              // related-list mode only
    externalVariables = 'Status=Open,Closed;Priority=High';
    inputRecords;                  // JSON string 
    gridConfig;                    // JSON string, forwarded to the grid app
 
    selectedRecords = [];
 
    connectedCallback() {
        this.template.addEventListener(
            'lightning__flowattributechange',
            this.handleGridChange
        );
    }
 
    handleGridChange = (event) => {
        const { attributeName, value } = event.detail;
        if (attributeName === 'outputRecords' && value) {
            const parsed = JSON.parse(value);   // { records: [...], objectId: 'Account' }
            this.selectedRecords = parsed.records;
        }
    };
} 
```

{% endcode %}

Replace the example `gridId` with the Grid ID you want to display.

You can then customize the other properties depending on what you want your Grid to do.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2F1s2ymnkbL4XYfR9R6tSF%2FConfigure%20the%20Grid%20in%20the%20JavaScript%20file.gif?alt=media&amp;token=54c9fbc2-80f7-4361-8077-6e7d9cd444f4" alt=""><figcaption><p>Configure the Grid in the JavaScript File</p></figcaption></figure>

***

### Grid properties

<table><thead><tr><th width="184.77783203125">HTML attribute</th><th width="178.111083984375">JS property</th><th width="99.22216796875">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>grid-id</code></td><td><code>gridId</code></td><td>String</td><td><strong>Required.</strong> <code>ObjectAPIName::ViewId</code>.</td></tr><tr><td><code>height</code></td><td><code>height</code></td><td>Integer</td><td>Grid height in pixels. Minimum 600. Omit it and the grid falls back to <code>85vh</code>.</td></tr><tr><td><code>can-change-grid</code></td><td><code>canChangeGrid</code></td><td>Boolean</td><td>Shows or hides the in-grid view switcher, letting users move between views they have access to.</td></tr><tr><td><code>record-id</code></td><td><code>recordId</code></td><td>String</td><td>Record context for the grid. Also affects page styling — see <a href="#important-behavior">Important Behavior</a>. </td></tr><tr><td><code>relationship-name</code></td><td><code>relationshipName</code></td><td>String</td><td>API name of the lookup field on the child object, for example <code>AccountId</code>. Switches the grid into related-list mode.</td></tr><tr><td><code>external-variables</code></td><td><code>externalVariables</code></td><td>String</td><td>Dynamic filter inputs in the form <code>Field=value1,value2;Field2=value3</code>.</td></tr><tr><td><code>input-records</code></td><td><code>inputRecords</code></td><td>String</td><td>JSON payload of records to load into the grid. See <a href="#display-related-records">Display related records</a>.</td></tr><tr><td><code>grid-config</code></td><td><code>gridConfig</code></td><td>String</td><td>JSON configuration passed through to the grid application. See <a href="/valorx-wave/wave-advanced/dynamic-grid.md">Dynamic Grid</a>.</td></tr><tr><td><code>output-records</code></td><td><code>outputRecords</code></td><td>String</td><td>Read-only from the consumer’s point of view. See <a href="#read-records-selected-by-the-user">Read Records Selected by the User</a>.</td></tr></tbody></table>

***

{% endstep %}

{% step %}

#### Configure The Component Metadata

&#x20;Open `myGridWrapper.js-meta.xml`. and add the following configuration:

{% code title="myGridWrapper.js-meta.xml" overflow="wrap" %}

```xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>62.0</apiVersion>
    <isExposed>true</isExposed>
    <masterLabel>My Grid Wrapper</masterLabel>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
    </targets>
</LightningComponentBundle>
```

{% endcode %}

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FmoP40D8YOXZeNX3iIyLP%2FConfigure%20the%20component%20metadata.gif?alt=media&amp;token=e7ec99c5-972b-4542-b285-d5721a6b811b" alt=""><figcaption><p>Configure The Component Metadata</p></figcaption></figure>

Here's what each setting does:

<table><thead><tr><th width="149">Setting</th><th>Description</th></tr></thead><tbody><tr><td><code>apiVersion</code></td><td>Specifies the Salesforce API version used by the component. The example uses <strong>62.0</strong>, which meets the minimum requirement of 55.0.</td></tr><tr><td><code>isExposed</code></td><td>Makes the component available in Lightning App Builder.</td></tr><tr><td><code>targets</code></td><td>Specifies where you can place the component.</td></tr></tbody></table>

This example allows you to add the component to:

* App Pages
* Record Pages
* Home Pages
  {% endstep %}

{% step %}

#### Deploy and Add The Component

Deploy the component to your Salesforce org.

For example, using Salesforce CLI:

```
sf project deploy start --source-dir force-app/main/default/lwc/myGridWrapper
```

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FKht1XnFSMMBiH41Ug4px%2FDeploy%20Component.gif?alt=media&amp;token=76256ca9-e979-4187-831b-c1968ad5fb83" alt=""><figcaption><p>Deploy the component using Lightning Studio</p></figcaption></figure>

After the deployment is complete:

1. Open **Lightning App Builder**.
2. Open the App Page, Record Page, or Home Page where you want to add the Grid.
3. Find your **My Grid Wrapper** component.
4. Drag the component onto the page.
5. Save and activate the page.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FnzEqWKgKlBzgq7cjEm8h%2FSave%20and%20Activate%20component.gif?alt=media&amp;token=740a103e-7a18-40c6-a6ab-0df0609c48d0" alt=""><figcaption><p>Save and Activate the component</p></figcaption></figure>

Your Valorx Grid is now available on the Salesforce page.
{% endstep %}
{% endstepper %}

***

## Optional Configurations

The following configurations are only needed for specific use cases. If you only need to display a Grid, you can skip this section.

### Pass Records Into The Grid

Use `inputRecords` when your LWC needs to provide a specific list of records to the Grid.

For example:

```json
this.inputRecords = JSON.stringify({
    objectId: 'Account',
    records: [
        { Id: '0015g00000XyZ12AAB' },
        { Id: '0015g00000XyZ13AAB' }
    ]
});
```

The payload must contain:

* `objectId`: API name of the Salesforce object.
* `records`: array of records.

The Grid retrieves the fields required by the configured Grid view and processes the records in batches of 1,000.

You can provide up to **10,000 records**.

If the JSON is invalid or either required property is missing, the Grid displays a validation error.

> **Important:** `inputRecords` is read when the Grid first loads. Changing its value afterward does not automatically update the Grid.

***

### Display Related Records

Use related-list mode when you want the Grid to display records related to another Salesforce record.

For example, you can display Contacts related to an Account.

You need:

* `recordId`: the ID of the parent record.
* `relationshipName`: the lookup field that connects the child record to the parent.

Example:

```json
<valorxwave-valorx-grid
    grid-id="Contact::a0X5g000004ABCDEAO"
    record-id={recordId}
    relationship-name="AccountId"
    height="700">
</valorxwave-valorx-grid>
```

In this example:

* `grid-id` identifies the Contact Grid.
* `record-id` identifies the current Account.
* `relationship-name="AccountId"` tells the Grid how the Contact is related to the Account.

The `relationshipName` value must be the API name of the lookup field on the child object.

***

### Read Records Selected by the User

Use `outputRecords` if your LWC needs to know which records the user selects in the Grid.

When a user selects records, the Grid returns the selected records in the following format:

```json
{
  "records": [
    {
      "Id": "0015g00000XyZ12AAB",
      "Name": "Acme Corp"
    }
  ],
  "objectId": "Account"
}
```

#### Listen for selection changes

Add the following listener to your JavaScript file:

```js
connectedCallback() {
    this.template.addEventListener(
        'lightning__flowattributechange',
        this.handleGridChange
    );
}
```

Then add the event handler:

```js
handleGridChange = (event) => {
    const { attributeName, value } = event.detail;

    if (attributeName === 'outputRecords' && value) {
        const parsed = JSON.parse(value);
        this.selectedRecords = parsed.records;
    }
};
```

You can then use `this.selectedRecords` in your LWC.

> **Note:** Use `addEventListener()` to listen for `lightning__flowattributechange`. The standard LWC `on...` template syntax does not work with this event name.

#### Read the current selection directly

You can also read the current selection directly from the Grid:

```json
const grid = this.template.querySelector('valorxwave-valorx-grid');
const output = JSON.parse(grid.outputRecords);
```

***

## Important Behavior

Keep the following points in mind when working with the Grid.

#### Most Grid properties are applied when the Grid loads

The following properties are read when the Grid first loads:

* `gridId`
* `height`
* `canChangeGrid`
* `recordId`
* `relationshipName`
* `externalVariables`
* `inputRecords`

If you change these values after the Grid has loaded, the Grid does not automatically update.

To apply the new value, remove and recreate the Grid component.

For example:

```js
<template if:true={showGrid}>
    <valorxwave-valorx-grid
        grid-id={gridId}
        height={height}>
    </valorxwave-valorx-grid>
</template>
```

Then recreate the Grid after changing the value:

```js
switchGrid(newGridId) {
    this.showGrid = false;
    this.gridId = newGridId;

    Promise.resolve().then(() => {
        this.showGrid = true;
    });
}
```

`gridConfig` is the exception. Changes to `gridConfig` can be applied after the Grid has loaded.

#### An empty `recordId` hides the Salesforce page header

If `recordId` is empty, the Grid hides the standard Salesforce page header so it can use the available page height.

This is expected behavior.

If you want the Salesforce page header to remain visible, provide a `recordId`.

#### Use only one Grid per page

Only one Valorx Grid should be embedded on a page.

Using multiple Grids on the same page is not supported and may cause the Grids to interfere with each other.

#### Keep the Grid at least 600 px high

Keep the Grid at least **600 px** high.

The Grid's toolbar and pagination controls need enough vertical space to display correctly.

***

## Troubleshooting

<table data-search="false"><thead><tr><th width="227">Problem</th><th>What to check</th></tr></thead><tbody><tr><td><strong>Insufficient Permission</strong> message</td><td>Make sure the user has <strong>Vx Grid Runtime User</strong> or the appropriate Experience Cloud permission.</td></tr><tr><td><strong>Grid area is blank</strong></td><td>Check that the Grid ID contains both the object name and View ID, separated by <code>::</code>.</td></tr><tr><td><strong>Validation error</strong></td><td>If you are using <code>inputRecords</code>, make sure it contains valid JSON with both <code>objectId</code> and <code>records</code>.</td></tr><tr><td><strong>Changing a property does not update the Grid</strong></td><td>Most properties are applied when the Grid loads. Recreate the Grid to apply the new value.</td></tr><tr><td><strong>Salesforce page header disappears</strong></td><td>This happens when <code>recordId</code> is empty. Provide a <code>recordId</code> if you want the header to remain visible.</td></tr><tr><td><strong>Selected records are not returned</strong></td><td>Make sure <code>lightning__flowattributechange</code> is registered with <code>addEventListener()</code> on <code>this.template</code>.</td></tr></tbody></table>

***

## Get Grid ID

You can get the Grid ID from either the **Wave Dashboard** or the **Surf the Wave** tab.

#### Option 1: From the Wave Dashboard

1. Open the **Wave Dashboard**.
2. Find the grid for which you want to get the Grid ID.
3. Click the **More options (⋮)** button for the grid.
4. Select **Publish**.
5. In the **Grid Publish Details** window, look at the **top-right corner** to find the **Grid ID**.
6. Click the **Copy** icon next to the Grid ID to copy it.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2Fbf33FNNjExw0w7ByXeqI%2FFind%20Grid%20ID%20Wave%20Dashboard.gif?alt=media&amp;token=5203594b-c192-43f0-9fb8-8ee8247a2ccd" alt=""><figcaption><p>Grid ID Wave Dashboard</p></figcaption></figure>

#### Option 2: From the Surf the Wave Tab

1. Open the **Surf the Wave** tab.
2. Open the grid for which you want to get the Grid ID.
3. At the top right, click **How to Publish** or **Published** button.
4. The **Grid Publish Details** window opens.
5. In the **top-right corner**, find the **Grid ID**.
6. Click the **Copy** icon next to the Grid ID to copy it.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FEBTiqzUqBdLutHHMF1pM%2FFind%20Grid%20ID%20Surf%20The%20Wave.gif?alt=media&amp;token=c335d92d-1fc0-4b67-a34f-1328172f8dda" alt=""><figcaption><p>Grid ID Surf The Wave</p></figcaption></figure>

> **Tip:** You can use either method to get the same Grid ID. If you already have the grid open in the **Surf the Wave** tab, using **How to publish** or **Published** is usually the quickest way to find it.

***
