CMS Development

Woodsy
Top Contributor

Call Multi Select Items from HubDb

SOLVE

Hi

I am trying to call Hubspot database items into a custom module using a HubDb row field. I can call text and images that are stored in the database but not multi select items.

The field looks like this:
Screenshot 2024-11-26 180522.png

Titles can be called using:

 

{{ item.resource.columns.name }}

 

 Description is:

 

{{ item.resource.columns.description }}

 

Image can be called using:

 

{{ item.resource.columns.image.url}}

 


If I use the following code it pulls back a lot of info around the multiselect rather than just the actual items.

 

{{ item.resource.columns.type }}

 

Screenshot 2024-11-26 181000.png

Here is the database column for reference:
Screenshot 2024-11-26 180800.png

Thank you in advance for any assistance.

0 Upvotes
1 Accepted solution
GiantFocal
Solution
Top Contributor | Partner
Top Contributor | Partner

Call Multi Select Items from HubDb

SOLVE

Hi @Woodsy,

 

Multi-select field return arrays; you can use a for loop to display the values.

You can replace your {{ item.resource.columns.type }} with the following:

 

{% for type in item.resource.columns.type %}
{{ type.name }}
{% endfor %}

 

Best regards,
Ernesto @ GiantFocal
Found this answer helpful?
Marking it as the solution helps both the community and me - thanks in advance!

View solution in original post

0 Upvotes
4 Replies 4
GiantFocal
Solution
Top Contributor | Partner
Top Contributor | Partner

Call Multi Select Items from HubDb

SOLVE

Hi @Woodsy,

 

Multi-select field return arrays; you can use a for loop to display the values.

You can replace your {{ item.resource.columns.type }} with the following:

 

{% for type in item.resource.columns.type %}
{{ type.name }}
{% endfor %}

 

Best regards,
Ernesto @ GiantFocal
Found this answer helpful?
Marking it as the solution helps both the community and me - thanks in advance!
0 Upvotes
Woodsy
Top Contributor

Call Multi Select Items from HubDb

SOLVE

Hi @GiantFocal if there is more than 1 item in the multi select how would I adapt this code to show the first item in the multi select only? Thanks

0 Upvotes
Woodsy
Top Contributor

Call Multi Select Items from HubDb

SOLVE

Thank you Ernesto @GiantFocal, that worked perfectly.

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

Call Multi Select Items from HubDb

SOLVE

Hi @Woodsy 👋 Thanks for your question. I'd like to ask some of our community champions if they have any HubDB wisdom they can share with us — hey @GiantFocal @Anton @jeremymandle, do you have any suggestions for @Woodsy?

 

Thank you very much for taking a look! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes