CMS Development

Indra
Orientador(a) | Parceiro Elite
Orientador(a) | Parceiro Elite

Choice field / select a row from HubDB list within a custom module

resolver

Is there a way to let the user select an row from a HubDB to select 1 item inside a custom module?

 

I don't want the user to copy and past the row ID and make it more simple by letting them select an row from a choice field. 

 

I have seen the following sollution: 
https://community.hubspot.com/t5/CMS-Development/Pulling-a-hubdb-column-in-as-a-choice-dropdown/td-p...

This will not work since "export_to_template_context=True" does not work with a custom module.

 

I think there should be a new field to select a row from a selected hubdb to extract data from that row.


Vet Digital - The Growth Agency | HubSpot Solutions Partner Agency

Did my post solve your question? Help the community by marking it as a solution
1 Solução aceita
alyssamwilie
Solução
Especialista reconhecido(a) | Parceiro Elite
Especialista reconhecido(a) | Parceiro Elite

Choice field / select a row from HubDB list within a custom module

resolver

Hubspot just released yesterday a HubDB Row field in Custom Modules. Available to Marketing Hub Professional & Enterprise customers, as well as all CMS Hub Professional & Enterprise customers.

 

https://www.hubspot.com/product-updates/easily-leverage-hubdb-with-the-new-hubdb-row-field

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.

Exibir solução no post original

10 Respostas 10
CP-BWG
Colaborador(a)

Choice field / select a row from HubDB list within a custom module

resolver

If you are using a module that has a HubDB row field in it, and then try to programmatically pass a selection from that field inside the module itself, you will likely struggle to figure out how to reference the selection of a hubDB row.  Why?  Because the page that shows how to reference fields inside modules has every other conceivable field other than a HubDB Row.  Has the UbDB Table, but not a row.

 

Here's how you pass a hubDB row field selection inside a module that is referencing a table using foreign key:

hubDB_row_selection_field_being_passed_to_custom_module={id={{hubDB_foreign_key_field_in_table.hs_id}}}

 

alyssamwilie
Solução
Especialista reconhecido(a) | Parceiro Elite
Especialista reconhecido(a) | Parceiro Elite

Choice field / select a row from HubDB list within a custom module

resolver

Hubspot just released yesterday a HubDB Row field in Custom Modules. Available to Marketing Hub Professional & Enterprise customers, as well as all CMS Hub Professional & Enterprise customers.

 

https://www.hubspot.com/product-updates/easily-leverage-hubdb-with-the-new-hubdb-row-field

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
SandyG1
Colaborador(a) | Parceiro
Colaborador(a) | Parceiro

Choice field / select a row from HubDB list within a custom module

resolver

This is game changing! Super powerful 🙂  thanks for sharing this @alyssamwilie 

 

Indra
Orientador(a) | Parceiro Elite
Orientador(a) | Parceiro Elite

Choice field / select a row from HubDB list within a custom module

resolver

No, sadly not. An alternative version of above I use is using the query param.

 

{% set db = module.content.db %}
{% set search = module.search %}
{% set queryparam = '&orderBy=order' %}
{% set rows = hubdb_table_rows(db, queryparam) %}

{% if search %}
  {% set queryparam = queryparam~"&name__contains="~search %}
{% endif %}

{# Loop through array #}
{% for row in rows %}
  {{ row.name }}
{% endfor %}

Vet Digital - The Growth Agency | HubSpot Solutions Partner Agency

Did my post solve your question? Help the community by marking it as a solution
0 Avaliação positiva
Eelko
Participante | Parceiro Elite
Participante | Parceiro Elite

Choice field / select a row from HubDB list within a custom module

resolver

Idra, did you manage to get it working? I`m searching for the same solution but no luck finding it in the community docs

Greets Eelko

0 Avaliação positiva
Indra
Orientador(a) | Parceiro Elite
Orientador(a) | Parceiro Elite

Choice field / select a row from HubDB list within a custom module

resolver

No. Sadly not. Had to create two fields where one let the user select a hubDB and one with a search field so you can search by a row. For example:

 

{# Text field #}
{% set search = module.content.search %}
{# HubDB field #} {% set db = module.content.db %}
{# Creat array of employees #} {% set employees_list = hubdb_table_rows(db) %}
{# Creat filtered array of employees by the search term #} {% set employees = employees_list|selectattr('fullname', 'equalto', search) %}
{# Loop through array #} {% for employee in employees %} {{ employee.fullname }} {% endfor %}

Vet Digital - The Growth Agency | HubSpot Solutions Partner Agency

Did my post solve your question? Help the community by marking it as a solution
0 Avaliação positiva
Schascha
Participante

Choice field / select a row from HubDB list within a custom module

resolver

Need the same Feature for a products table 😄 Solutions are very welcome-

Thanks

0 Avaliação positiva
MikeBeatwoot
Participante

Choice field / select a row from HubDB list within a custom module

resolver

Hey, did you manage to get it working? I`m searching for the same solution to choose from a testimonial in a table.

Would be amazing. 🙂

Thanks,
Mike

0 Avaliação positiva
SandyG1
Colaborador(a) | Parceiro
Colaborador(a) | Parceiro

Choice field / select a row from HubDB list within a custom module

resolver

Hi Indra,


If I understand correctly, could you not do something like this?

<select>
{% for row in hubdb_table_rows(<tableId or name>, <filterQuery>) %}
<option value="{{ row.hs_id }}">{{ row.<column name> }}</option>
{% endfor %}
</select>


This would give them a select dropdown of all the rows and then you can continue to do it as though they input the ID themselves? (Which ever way you're doing that)


Unless you need this inside the menu on the edit screen in which case, this wouldn't work of course

 

Kind regards,

Sandy

0 Avaliação positiva
Indra
Orientador(a) | Parceiro Elite
Orientador(a) | Parceiro Elite

Choice field / select a row from HubDB list within a custom module

resolver

Hi SandyG1,

 

It's not for the front-end (visitor) to select an item. It is for the person who created the website/page and for them to select just one row from the HubDB inside a custom module.

 

Thanks for thinking out loud.

Indra


Vet Digital - The Growth Agency | HubSpot Solutions Partner Agency

Did my post solve your question? Help the community by marking it as a solution
0 Avaliação positiva