# Use state parameter inside custom query of Connect Data binding to model?

**URL:** <https://forum.builder.io/t/use-state-parameter-inside-custom-query-of-connect-data-binding-to-model/15851>\
**Category:** Visual Editor Help\
**Created:** [October 9, 2025, 10:08pm UTC](https://forum.builder.io/t/use-state-parameter-inside-custom-query-of-connect-data-binding-to-model/15851 "2025-10-09T22:08:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wsaunders](https://avatars.discourse-cdn.com/v4/letter/w/f04885/32.png) [@wsaunders](https://forum.builder.io/u/wsaunders)\
**Post date:** [October 9, 2025, 10:08pm UTC](https://forum.builder.io/t/use-state-parameter-inside-custom-query-of-connect-data-binding-to-model/15851/1 "2025-10-09T22:08:30Z")

</div>

_Please fill out as many of the following questions as possible so we can help you promptly! If you don’t know how to answer or it does not apply, feel free to remove it or leave it blank._

**Builder content link**  
Symbol:

> **[Builder.io: Visual Development Platform](https://builder.io/content/86c4a31f0077496096f43ee97dca3ae3_c341a436a39f44d49cd415854bff92d3/edit?activeDesignerTab=0&selectedBlock=builder-c343b705abbb47c2b1272349ba8f3981&activeLocale=Default)**
>
> Builder is an AI-Powered Visual Development Platform that helps teams generate, iterate, and optimize web and mobile experiences in seconds instead of sprints.

Offer page:

> **[Builder.io: Visual Development Platform](https://builder.io/content/86c4a31f0077496096f43ee97dca3ae3_c6a01ef85a7d4052888dc660dc2efae3/edit?activeDesignerTab=3&activeLocale=Default)**
>
> Builder is an AI-Powered Visual Development Platform that helps teams generate, iterate, and optimize web and mobile experiences in seconds instead of sprints.

\*\*  
Builder public api key\*\*  
86c4a31f0077496096f43ee97dca3ae3

**What are you trying to accomplish**  
\*Okay this is kind of complicated. So bear with me.

Currently, we have a list of symbols with product names that we use on our offer page. We use dynamic symbol function to pull the correct Product name by targeting the symbol with a query parameter. Example: /offers?offerId=p90x will load the Offers page and the heading will say “Get P90x” etc. So we have dozens of products which means we have dozens of symbols. Everytime we add a product, we add a symbol. Seems tedious and unnecessary.

I have a heading symbol that has a content input of “Offer ID”, this should look up the entry of the Offer Heading model that corresponds. On the offer page itself I am using custom code to fill the content input with the offer id from the query parameter:\*

```javascript
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const hasOfferId = urlParams.has('offerId');
const offerId = (hasOfferId) ? urlParams.get('offerId'):false;

```

 ![Screenshot 2025-10-09 at 3.01.30 PM](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/6/638fac1851f2da04db1bb0c47f4f5d3fe1cd83d2.png)

Seems like it’s working. However the issue I’m having is on the connect data tab:

 ![Screenshot 2025-10-09 at 2.49.55 PM](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/c/cf04f45f506e67b79b0d89428c462d469862f486.png)

I need this to be dynamic based on the content input of the symbol. So something like `state.offerId`. This would select the right entry from the Structured Data Model “Offer Headings” but it doesn’t seem to accept anything but plain text of the exact thing you want. When I try a custom query, it gives an error about “value expected (json 516):

 ![Screenshot 2025-10-09 at 3.05.59 PM](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/0/0b87cb3035142c6dc223e4a8d2c332917bf0fe28.png)

**Code stack you are integrating Builder with**  
_NextJS, react, Shopify_

---

<div class="post-metadata">

**Author:** ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)\
**Post date:** [October 23, 2025, 7:10pm UTC](https://forum.builder.io/t/use-state-parameter-inside-custom-query-of-connect-data-binding-to-model/15851/2 "2025-10-23T19:10:33Z")

</div>

Hello @wsaunders,

Using dynamic variables in a custom query within [Builder.io](http://Builder.io) is **not supported** , so expressions like `state.offerId` cannot be used directly in the Connect Data tab to filter structured data.

To achieve dynamic filtering, you have two options:

1. **Use JavaScript inside your symbol or page** to fetch and filter data dynamically. You can implement this using [Builder.io](http://Builder.io)’s [Custom Code documentation](https://www.builder.io/c/docs/custom-code), which explains how to run JS code within symbols or pages to manipulate content dynamically.
2. **Filter the data at the codebase level** before passing it to your Builder page. You can fetch the relevant entries in your frontend or backend code and then pass them to Builder as props or state. Examples for this pattern are shown in the [Code Data documentation](https://www.builder.io/c/docs/buildercomponent#code-data-code).

Additionally, if you need to trigger dynamic actions based on the data or user interaction, you can leverage [Custom Actions](https://www.builder.io/c/docs/custom-actions), which allow you to run JavaScript in response to events and manipulate content dynamically.

> **[The definitive guide to building a drag and drop editable blog with Builder](https://www.builder.io/blog/builder-drag-drop-blog)**
>
> Design a composable blog experience with Builder that is dynamic and fits your team's workflow. Walk through some of our top examples and how to implement them

Thanks,
