# Form Features - Use Dynamic Salesforce Data with Record Datasets

## Overview

[**Record Datasets**](/forms/salesforce-integration/record-datasets.md) let you use Salesforce data inside SharinPix Forms.

This feature is currently available for **Select** and **Multi-Select** questions. It lets you populate options from a **Record Dataset** generated from Salesforce records.

Use it when the available options should reflect Salesforce data instead of a fixed list entered in the form builder.

{% hint style="info" %}
Refresh your Record Datasets regularly to keep options in sync with Salesforce.
{% endhint %}

This article covers:

* [Configure dynamic Select or Multi-Select options with a Record Dataset](#configure-dynamic-select-or-multi-select-options-with-a-record-dataset)
  * [Choose the label and value fields](#choose-the-label-and-value-fields)
  * [Filter available rows](#filter-available-rows)
* [Demo: Select Employees based on their Company](#demo-select-employees-based-on-their-company)

### Configure dynamic Select or Multi-Select options with a Record Dataset

Add a **Select** or **Multi-Select** question.

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

In the **Options** tab, click **Select a dataset** and choose one of the available **Record Datasets**.

{% hint style="info" %}
Create the Record Dataset first before configuring the question.

Refer to [How to Create a Record Dataset](/forms/salesforce-integration/record-datasets.md#how-to-create-a-record-dataset).
{% endhint %}

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

The available fields depend entirely on the columns exported into the Record Dataset.

In this example, the dataset includes:

* `Id`
* `Name`
* `SiteAddress__c`
* `SiteArea__c`
* `SiteType__c`
* `Inspection__c`

If a field is not present in the dataset, you cannot use it in the question configuration or the filter formula.

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

### Choose the label and value fields

After selecting the dataset, choose which column should be used as:

* the **label**, which is shown to the user
* the **value**, which is stored in the form response

In most cases, use a readable field for the label and a stable field for the value.

For example, you might display `Name` while storing `Id`.

You can keep static options or remove them, depending on whether the question should rely entirely on the selected dataset.

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

#### Filter available rows

In the **CSV Filter (formula)** field, reference dataset columns with `row.<column_name>`.

You can use any column exported in the dataset inside the filter.

With the example dataset above, valid references include:

* `row.Id`
* `row.Name`
* `row.SiteAddress__c`
* `row.SiteArea__c`
* `row.SiteType__c`
* `row.Inspection__c`

Use this filter to show only rows that match specific values.

In this example, the filter keeps only Site records where `SiteArea__c > 500`.

<figure><img src="/files/38g9D7EykzOqjRO9yBrj" alt=""><figcaption></figcaption></figure>

For example:

* `row.SiteArea__c > 500` keeps only large sites
* `row.SiteType__c == "Industrial"` keeps only industrial sites
* `row.Inspection__c == inspection_id` keeps only sites linked to the current Inspection

The available options now include only records where `SiteArea__c` is greater than `500`.

<figure><img src="/files/0yIkdRgnVsMgfJyM7Ije" alt=""><figcaption></figcaption></figure>

#### Remove duplicate values

If the dataset contains repeated values in the same column, the question can show duplicate options.

Enable `Remove duplicate values from CSV` to keep only one option for each repeated value.

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

### Demo: Select Employees based on their Company

{% hint style="warning" %}
**Prerequisite for this example:**

* Create a **Companies** dataset.
* Create an **Employees** dataset with a `Company__c` lookup field.
  {% endhint %}

#### Step 1: Set up the company Select question

Add a **Select** question with the API name `company`.

Select the **Companies** dataset.

Use `Name`, or another readable field, as the label.

Use `Id` as the value. This value will be used to filter the **Employees** dataset.

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

#### Step 2: Set up the employees Multi-Select question

Add a **Multi-Select** question.

Select the **Employees** dataset.

Use [Filter available rows](#filter-available-rows) to keep only employees linked to the selected company.

In this example, use:

`row.Company__c == company.value`

<figure><img src="/files/9LsJBxwSuKgqG7y9VJ5d" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
**Tip:**\
\
If you want to get the company ID from the form launch URL, or from a Salesforce field on the record where the form is launched, configure a hidden text question with [Prefill](/forms/form-elements/form-features-default-or-prefill-values.md). You can then reference that hidden field in the filter instead.
{% endhint %}


---

# Agent Instructions: 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:

```
GET https://docs.sharinpix.com/forms/form-elements/form-features-use-dynamic-salesforce-data-with-record-datasets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
