# Valorx Grid in Flow

## Overview

Connect the Valorx Grid to your Salesforce Flow so users can review, select, and create multiple records all within a single workflow.

Grid integration supports two main operations:

<table data-card-size="large" data-view="cards" data-full-width="false"><thead><tr><th></th></tr></thead><tbody><tr><td><h4>Grid Input</h4><p>Pass records <strong>into</strong> the grid from Flow. The grid displays them for users to review. Useful for confirming or previewing records.</p></td></tr><tr><td><h4>Grid Output</h4><p>Let users <strong>select</strong> rows and emit them back to Flow as JSON. Flow then processes the selected records in later steps.</p></td></tr></tbody></table>

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FiRy2aCNM4u00tgoebFYR%2FGrid%20Flow.png?alt=media&#x26;token=c60d7623-8f23-41a6-8b9b-0894ea20fd15" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FHGoHAO8Oiyk4GF8FoY9L%2FOpportunity%20Flow.gif?alt=media&#x26;token=943cd715-ab6d-4726-888a-adcb982e3d6b" alt=""><figcaption><p>Valorx Grid in Flow</p></figcaption></figure>

***

## End-to-end example: Opportunity Product Selection

This walkthrough shows how to build a Flow that lets users pick products from a Price Book grid and automatically create Opportunity Products with a preview at the end.

<table data-view="cards"><thead><tr><th align="center"></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td align="center"><p><strong>GRID 1</strong><br>Opportunity Grid<br>Launches the Flow via row action</p><p><strong>Trigger</strong></p></td><td></td></tr><tr><td align="center"><p><strong>GRID 2</strong><br>Price Book Entries<br>User selects </p><p></p><p><strong>Output grid</strong></p></td><td></td></tr><tr><td align="center"><p><strong>GRID 3</strong><br>Opportunity Products<br>Preview of created</p><p></p><p><strong>Input grid</strong></p></td><td></td></tr></tbody></table>

#### Grid 1 – Opportunity Grid

* Contains a [**Row Action**](https://docs.valorx.com/valorx-wave/wave-experience/create-a-new-grid/grid-wizard-in-salesforce#row-action) that launches the Flow.

  The row action passes:

  * Opportunity ID
  * Price Book ID

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2F7NYaV0NseTCp5UgavrJc%2Fimage.png?alt=media&#x26;token=1dd9d6b4-bde1-4aed-aaed-3d7a0fd1ac38" alt=""><figcaption><p>Opportunity Grid</p></figcaption></figure>

#### Grid 2 – Price Book Entries Grid (Output Grid)

* Object: **Price Book Entries**
* This grid uses a [dynamic filter](https://docs.valorx.com/valorx-wave/wave-data-management/managing-grid-data/dynamic-filter) to ensure that only products associated with the selected Price Book are displayed.

Purpose:

* Displays products from the selected Price Book
* Allows users to select multiple products
* Emits selected records in JSON format

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FIOkFnocNALrvA4cq84S7%2FPrice%20Book%20Product%20Dynamic%20Filter.png?alt=media&#x26;token=958f68fd-147b-48f1-a402-c137a9e501d2" alt=""><figcaption></figcaption></figure>

#### Grid 3 – Opportunity Product Grid (Input Grid)

* Object: **Opportunity Product (OpportunityLineItem)**

Purpose:

* Displays the Opportunity Products created by the Flow
* Accepts records passed from the Flow as JSON

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FWcJsuNgv5WaA1Tb0vk10%2Fimage.png?alt=media&#x26;token=55fba476-322d-418d-8764-e69323c7c435" alt=""><figcaption></figcaption></figure>

***

## Step-by-Step Configuration

### Step 1 - Create required Flow variables

Before building any screens or logic, set up the three variables you'll need throughout the Flow.

{% stepper %}
{% step %}

#### Variable 1 — Store selected records as JSON

The grid emits selected records as a JSON string. This variable captures that output so it can be passed to an Apex action later.

<table><thead><tr><th width="259">Setting</th><th>Value</th></tr></thead><tbody><tr><td>API Name</td><td><code>priceBookEntryRecordsJson</code></td></tr><tr><td>Data Type</td><td>Text</td></tr><tr><td>Available for Output</td><td>Enabled</td></tr></tbody></table>

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FrI2YyGOpjqQjIqpNcghv%2F1.1%20Variable%20to%20store%20Pricebook%20records.gif?alt=media&#x26;token=881247bc-0ba5-418b-b730-cf8749657279" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Price Book ID (for dynamic filtering)

Holds the Price Book ID passed in by the row action. Used to filter the grid so users only see products from the correct Price Book.

<table><thead><tr><th width="236">Setting</th><th>Value</th></tr></thead><tbody><tr><td>API Name</td><td><code>pricebookId</code></td></tr><tr><td>Data Type</td><td>Text</td></tr><tr><td>Available for Input</td><td>Enabled</td></tr></tbody></table>

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FxxUjdFqkp8pWZ4M7uFws%2F1.2%20Variable%20for%20Opportunity%20ID.gif?alt=media&#x26;token=996f1923-7136-4f73-9092-1d3d01cf19f7" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Variable 3 — Opportunity ID

Needed to link each new Opportunity Product to its parent Opportunity when the records are created.

<table><thead><tr><th width="257">Setting</th><th>Value</th></tr></thead><tbody><tr><td>API Name</td><td><code>oppId</code></td></tr><tr><td>Data Type</td><td>Text</td></tr><tr><td>Available for Input</td><td>Enabled</td></tr></tbody></table>

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2Fu0Cc9IyLffJka0KuMUmB%2F1.3%20Variable%20for%20Opportunity%20ID.gif?alt=media&#x26;token=67970af7-6b6f-4ea1-91bb-f200d1be7a30" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

***

### Step 2 – Configure the Product Selection Screen

Add a Screen element with a Valorx Grid so users can browse and select Price Book products.

{% stepper %}
{% step %}

#### Screen Configuration

Add a **Screen** element to the Flow.

<table><thead><tr><th width="233">Setting</th><th>Value</th></tr></thead><tbody><tr><td>Label</td><td>Grid Output</td></tr><tr><td>API Name</td><td><code>Grid_Output</code></td></tr></tbody></table>

Drag the **Valorx Grid** component from the Components panel onto the screen. Set its API Name to `PriceBookGrid`.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FoHPCnE40sxMmX48QUiV6%2F2.1%20Add%20Screen.gif?alt=media&#x26;token=d6b6fd15-0e7a-458e-adcc-feed7625d318" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Link the grid to Price Book Entries

Set the Grid ID — this connects the component to your published Valorx Grid:\
`PricebookEntry::34937bb2-c710-4ce2-b6c0-0f171085e6a0`

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2F0b1ctZRZcD2KDkkq6oex%2F2.2%20Configure%20Valorx%20Grid.gif?alt=media&#x26;token=e16c4af9-8a79-424f-bffe-a1bcd4c6f66b" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Find your Grid ID from the Wave Dashboard: open a Card → More Options → [Publish](https://docs.valorx.com/valorx-wave/wave-workspace/wave-dashboard#how-to-get-grid-id).
{% endhint %}
{% endstep %}

{% step %}

#### Configure Dynamic Filtering

To show only products from the selected Price Book, add this to the Input Variables of the grid component:

* Copy the configured [**Dynamic Filter**](https://docs.valorx.com/valorx-wave/wave-data-management/managing-grid-data/dynamic-filter) **value** from the grid and paste it into the **Flow input variable**.&#x20;
* **Example**: In **Input Variables**, add the filter:\
  `Pricebook2.Name = {!pricebookId}`
* This ensures the grid automatically filters records based on the Price Book ID passed in by the row action.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FTWaMSMHPdYHltBgLmsGU%2F2.2%20Configure%20Dynamic%20Filteing.gif?alt=media&#x26;token=d5960fec-97d2-4f4e-b4bc-8e0f503b44c2" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Store Selected Records

When the user clicks Next, the grid emits selected records as JSON. Store that output:

**Configuration**

* Expand the **Advanced** section.
* Enable **Manually assign variables**.
* Under **Output Records**, select **`priceBookEntryRecordsJson` .**

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FO70o91LmjYwrOqqpFPF0%2F2.3%20Store%20Selected%20Record.gif?alt=media&#x26;token=4cd8b5e0-c591-4392-85a3-9db2a483b148" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

***

### Step 3 – Convert JSON to to Salesforce Records

Flow can't work with raw JSON directly. So, we need to use the built-in Apex action to convert it into SObject records.

{% stepper %}
{% step %}

#### Create A Record Collection Variable

This collection will hold the converted `PricebookEntry` records so the Flow can loop over them.

<table><thead><tr><th width="241">Setting</th><th>Value</th></tr></thead><tbody><tr><td>API Name</td><td><code>pricebookEntryRecords</code></td></tr><tr><td>Data Type</td><td>Record</td></tr><tr><td>Object</td><td>PricebookEntry</td></tr><tr><td>Allow Multiple Values</td><td>Checked</td></tr></tbody></table>

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FHBbEA8RPFUsNI1E0lK1A%2F3.1%20Variable%20record.gif?alt=media&#x26;token=cde887ee-9774-4a70-8057-d1a204858801" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Add Apex Action – Convert JSON to Records

Valorx provides a built-in Apex Action **Convert JSON to Records.** Search for and add: Convert JSON to Records `valorxwave__VxJsonToCollection` that enables Flows to convert JSON data into Salesforce record collections.

Set the following fields:

| Field                         | Value                     |
| ----------------------------- | ------------------------- |
| Object for "records" (Output) | Price Book Entry          |
| jsonString                    | priceBookEntryRecordsJson |

Then enable *Manually assign variables* and store Output Records in `pricebookEntryRecords`.

{% hint style="warning" %}
This Apex action is **required** whenever you use Grid Output. Flow cannot iterate over a JSON string — it must be a record collection first.
{% endhint %}

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FIXPu5bxuByF1BsKUgn6b%2F3.2%20Add%20Apex%20Action.gif?alt=media&#x26;token=3fb0434a-813a-48c4-adb0-4b2079657b86" alt=""><figcaption></figcaption></figure>

> This action is required whenever Grid Output is used, as Flow cannot directly process JSON data.
> {% endstep %}
> {% endstepper %}

***

### Step 4 – Prepare Opportunity Product Variables

Create two variables: one for building each record inside the loop, and one collection to hold all the records before bulk insert.

{% stepper %}
{% step %}

#### Temporary record variable (built one at a time inside the loop)

<table><thead><tr><th width="234">Setting</th><th>Value</th></tr></thead><tbody><tr><td>API Name</td><td><code>tempOpportunityProductRecord</code></td></tr><tr><td>Data Type</td><td>Record</td></tr><tr><td>Object</td><td>Opportunity Product (OpportunityLineItem)</td></tr></tbody></table>

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2F2Eu68zQ3gyrGChtjKh3z%2F4.1%20Create%20Temporary%20Record%20Variable.gif?alt=media&#x26;token=2367ce49-b54b-49da-bec8-54d871cb9f78" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Record collection variable (accumulates all records for bulk insert)

<table><thead><tr><th width="238">Setting</th><th>Value</th></tr></thead><tbody><tr><td>API Name</td><td><code>newOpportunityProductsRecords</code></td></tr><tr><td>Data Type</td><td>Record</td></tr><tr><td>Object</td><td>Opportunity Product</td></tr><tr><td>Allow Multiple Values</td><td>Checked</td></tr></tbody></table>

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FnDQSGJSXvBPZYtK6rDFz%2F4.2%20Create%20Record%20Collection%20Variable.gif?alt=media&#x26;token=1140d9b6-3d84-4e79-a88c-3087398595d8" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

***

### Step 5 – Add Loop Element

Process each selected Price Book Entry one at a time to create a matching Opportunity Product.

Add a **Loop** element to the Flow and configure it:

<table><thead><tr><th width="280">Setting</th><th>Value</th></tr></thead><tbody><tr><td>Collection Variable</td><td><code>pricebookEntryRecords</code></td></tr></tbody></table>

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2Fafmh7ieT8o7xLb7dxMKe%2F5.1%20Loop.gif?alt=media&#x26;token=82afb806-0625-4b77-9f86-41891c8a7119" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Steps 6 and 7 both happen **inside** this loop. The loop runs once per selected product row.
{% endhint %}

***

### Step 6 – Assign Field Values (Inside The Loop)

Map fields from the selected Price Book Entry to the temporary Opportunity Product record.

Add an **Assignment** element inside the loop:

<table><thead><tr><th width="445">Variable</th><th width="117">Operator</th><th width="422">Value</th></tr></thead><tbody><tr><td><code>{!tempOpportunityProductRecord.PricebookEntryId}</code></td><td>Equals</td><td><code>{!Opportunity_Product_Assignment.Id}</code></td></tr><tr><td><code>{!tempOpportunityProductRecord.UnitPrice}</code></td><td>Equals</td><td><code>{!Opportunity_Product_Assignment.UnitPrice}</code></td></tr><tr><td><code>{!tempOpportunityProductRecord.Quantity}</code></td><td>Equals</td><td><code>1</code></td></tr><tr><td><code>{!tempOpportunityProductRecord.OpportunityId}</code></td><td>Equals</td><td><code>{!oppId}</code></td></tr></tbody></table>

**Explanation**

* **PricebookEntryId** links the Opportunity product to the selected product from the Price Book.
* **UnitPrice** copies the product price from the Price Book Entry.
* **Quantity** is set to **1** by default (users can adjust it later if needed).
* **OpportunityId** associates the product with the current Opportunity.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FpEStdaXzyHOjyVI5Ndvp%2F6.%20Assign%20Field%20Value.gif?alt=media&#x26;token=6eac9231-9c4b-4c3e-a388-974b515c4ac2" alt=""><figcaption></figcaption></figure>

***

### Step 7 – Add The Record to The Collection (Inside The Loop)

After building each Opportunity Product, add it to the collection so all records can be created together.

Add a second **Assignment** element inside the loop:

<table><thead><tr><th width="297">Variable</th><th width="139">Operator</th><th width="293">Value</th></tr></thead><tbody><tr><td><code>newOpportunityProductsRecords</code></td><td>Add</td><td><code>tempOpportunityProductRecord</code></td></tr></tbody></table>

This step adds each generated record to the **OpportunityLineItem collection**, building the complete list of products that will be created for the Opportunity in a single bulk operation.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2F91OvJXyzm4UPHCjZZSON%2F7.%20Add%20Temporary%20Opportunity%20Records.gif?alt=media&#x26;token=02725634-2623-4d67-998f-cdce077f1dac" alt=""><figcaption></figcaption></figure>

***

### Step 8 – Create Opportunity Products (Bulk Insert)

Insert all selected products in a single operation after the loop finishes — this is more efficient and avoids governor limits.

Add a **Create Records** element *after* the loop (not inside it):

<table><thead><tr><th width="319">Setting</th><th>Value</th></tr></thead><tbody><tr><td>How Many Records to Create</td><td>Multiple</td></tr><tr><td>Record Collection</td><td><code>newOpportunityProductsRecords</code></td></tr></tbody></table>

This step inserts all generated **OpportunityLineItem (Opportunity Product)** records at once, adding the selected products to the Opportunity.

{% hint style="warning" %}
Never use **Create Records** inside the loop — this inserts one record per DML call and will hit Salesforce governor limits for large selections.
{% endhint %}

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2Fj2myRlSBFvEUmBwDzQ48%2F8.%20Create%20Opportunity%20Line%20Items.gif?alt=media&#x26;token=95e8694f-1c65-4ec0-807f-f17952b3ad71" alt=""><figcaption></figcaption></figure>

***

### Step 9 – Convert Created Records Back to JSON

To show a preview grid, the records must be converted back to JSON format and that's what the Grid Input component expects.

{% stepper %}
{% step %}

#### Create JSON Text Variable

<table><thead><tr><th width="246">Setting</th><th>Value</th></tr></thead><tbody><tr><td>API Name</td><td><code>createdOpportunityProductJson</code></td></tr><tr><td>Data Type</td><td>Text</td></tr></tbody></table>

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FXHB96U8ST3Tt9g6zoLLU%2F9.%20Create%20JSON%20Variable.gif?alt=media&#x26;token=4722e5cb-4a5f-4f09-9093-b158a46599e8" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Add Apex Action: Records to JSON

Add the **Apex Action** **Records to JSON** (`valorxwave__VxCollectionToJson`) to convert the created records into JSON format.

| Field       | Value                           |
| ----------- | ------------------------------- |
| **Object**  | Opportunity Product             |
| **Records** | `newOpportunityProductsRecords` |

Enable *Manually assign variables* and store the output in `createdOpportunityProductJson`.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FrM1qgnQChfGwr2e92z3G%2F9.%20Add%20Apex%20Action%20Records%20to%20JSON.gif?alt=media&#x26;token=4784f21b-2aa8-4a0b-9e50-8d6f2a94c1ac" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

***

### Step 10 – Add Preview Screen

Show users the Opportunity Products that were just created, displayed in a read-only grid.

Add a new **Screen** element and drag a **Valorx Grid** component onto it. Configure the grid:

<table><thead><tr><th width="199">Field</th><th>Value</th></tr></thead><tbody><tr><td>Grid ID</td><td><code>OpportunityLineItem::d18f616d-631b-4587-a55e-ddb0c206f8ea</code></td></tr><tr><td>Input Records</td><td><code>createdOpportunityProductJson</code></td></tr></tbody></table>

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FKwxrqFGxCKUYP86lyEmM%2F10.%20Add%20Preview%20Screen.gif?alt=media&#x26;token=a4d2dab6-3c3c-4f16-b6b9-8e11a2116adf" alt=""><figcaption></figcaption></figure>

***

### Step 11 - Save and Activate the Flow

Once all steps are configured, save and activate to make the Flow available.

1. Click **Save** to save all changes.
2. Click **Activate** to publish the Flow.
3. The row action in your Opportunity Grid will now trigger this Flow.

{% hint style="info" %}
You can test the Flow in debug mode from the Flow builder before activating.
{% endhint %}

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FSOKiNkvdUQGa4I2GTPPW%2F11.%20Save%20and%20Activate.gif?alt=media&#x26;token=401e67a9-d14c-4240-8190-41bb5eadeebf" alt=""><figcaption></figcaption></figure>

***

## What happens when the Flow runs

1. User clicks a row action from the Opportunity Grid, launching the Flow with the Opportunity ID and Price Book ID.
2. The Price Book Entries grid loads, filtered to show only products from the selected Price Book.
3. User selects one or more products and clicks Next — the grid emits selected records as JSON.
4. The Apex action converts the JSON into a Salesforce record collection.
5. The Flow loops over the records, building an `OpportunityLineItem` for each selection.
6. All Opportunity Products are inserted in a single bulk operation.
7. The created records are converted back to JSON and passed to the preview grid.
8. The user sees a confirmation screen listing all newly created Opportunity Products.

<figure><img src="https://2237973035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F65f4C4H8V5e0YV342mwp%2Fuploads%2FHGoHAO8Oiyk4GF8FoY9L%2FOpportunity%20Flow.gif?alt=media&#x26;token=943cd715-ab6d-4726-888a-adcb982e3d6b" alt=""><figcaption></figcaption></figure>

***

## JSON Structure Reference (Advanced)

The Valorx Grid uses a structured JSON format when exchanging records with Salesforce Flow. This format is used internally by Apex actions such as:

* `VxJsonToCollection` (JSON → Records)
* `VxCollectionToJson` (Records → JSON)

The JSON consists of:

* A **records array** containing the data
* An **objectId** that identifies the Salesforce object

#### JSON Schema

```
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "records": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "objectId": {
      "type": "string"
    }
  },
  "required": ["records", "objectId"]
}
```

#### Example

```
{
  "objectId": "PricebookEntry",
  "records": [
    {
      "Id": "01u5g00000ABC123",
      "Name": "Product A",
      "UnitPrice": 100
    }
  ]
}
```

#### Notes

* The `records` array contains the selected or generated records
* Each record uses **Salesforce API field names**
* The `objectId` specifies the Salesforce object type
* This structure is required for Apex actions to correctly process the data
