CMS Development

RTeja
Member

HubSpot featured select field in design manager

SOLVE
Currently, I am working in the HubSpot Design Manager, where I am fetching and rendering data. When I switch to the Design Previewer, I can see the rendered data, which works perfectly.
I have manually added a choice field from the "Add Fields" option and provided the required options. This field also renders correctly in the previewer.
What I want to achieve is that, by selecting any option from this choice field, the rendered data should change based on the selected option.
The challenge I am facing is how to access this featured select field in the Design Manager code because I need to use the value of this select field in my code.
Currently, I am using a hardcoded value in my code, as shown below:

 

{% if row["13"] == "BMW" %}
If I can somehow access the value of the HubSpot featured select field, I can make this condition dynamic.
0 Upvotes
1 Accepted solution
Anton
Solution
Thought Leader | Partner
Thought Leader | Partner

HubSpot featured select field in design manager

SOLVE

Hi @RTeja

are you using HubDB? Just asking because "row" is pretty common when using HubDB. If you should use HubDB the markup should be like this:

 

{% if row[COLUMNNAME] == "an-input-from-HubDB" %}
lorem ipsum
{% elif row[COLUMNNAME] == "a-different-input-from-HubDB" %}
dolor set
{% endif %}

 

 

If you want to utilize plain module logic the markup should look like this:

 

{% if module.choice_field == "a-value-from-the-choice-option" %}
lorem ipsum
{% elif module.choice_field == "a-different-value-from-the-choice-option" %}
dolor set
{% endif %}

 

 

or

 

 

{% set my_custom_selector = module.choice_field %}

{% if my_custom_selector == "some-input" %}
lorem ipsum
{% elif mmy_custom_selector == "some-different-input" %}
dolor set
{% endif %}

 

("choice_field" is the name of your choice field)

 

So in your case it could be:

 

{% if module.choice_field == "BMW" %}
Content if BMW is selected
{% elif module.choice_field == "Audi" %}
Content if Audi is selected
{% endif %}

 

 

 

Also - while you technically could access the values of the choice_field,I don't recommend you to do so since you/HubSpot won't really know when to show which information. 

 

 

best, 

Anton

Anton Bujanowski Signature

View solution in original post

0 Upvotes
2 Replies 2
Anton
Solution
Thought Leader | Partner
Thought Leader | Partner

HubSpot featured select field in design manager

SOLVE

Hi @RTeja

are you using HubDB? Just asking because "row" is pretty common when using HubDB. If you should use HubDB the markup should be like this:

 

{% if row[COLUMNNAME] == "an-input-from-HubDB" %}
lorem ipsum
{% elif row[COLUMNNAME] == "a-different-input-from-HubDB" %}
dolor set
{% endif %}

 

 

If you want to utilize plain module logic the markup should look like this:

 

{% if module.choice_field == "a-value-from-the-choice-option" %}
lorem ipsum
{% elif module.choice_field == "a-different-value-from-the-choice-option" %}
dolor set
{% endif %}

 

 

or

 

 

{% set my_custom_selector = module.choice_field %}

{% if my_custom_selector == "some-input" %}
lorem ipsum
{% elif mmy_custom_selector == "some-different-input" %}
dolor set
{% endif %}

 

("choice_field" is the name of your choice field)

 

So in your case it could be:

 

{% if module.choice_field == "BMW" %}
Content if BMW is selected
{% elif module.choice_field == "Audi" %}
Content if Audi is selected
{% endif %}

 

 

 

Also - while you technically could access the values of the choice_field,I don't recommend you to do so since you/HubSpot won't really know when to show which information. 

 

 

best, 

Anton

Anton Bujanowski Signature
0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

HubSpot featured select field in design manager

SOLVE

Hi, @RTeja 👋 Thanks for your post. Let's invite some of our community members to the converstaion — hey @Anton @SteveHTM do you have a simple example you can share with @RTeja?

 

Thank you very much for taking a look! — Jaycee







HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.


Learn More.





Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !
0 Upvotes