APIs & Integrations

reedwf
Member

HUBL Get Values from Multiple Checkbox Field on Company Then Loop

I’m creating a custom module to place into an email. It will look at the contact’s company record for the product lines the company purchases and output a list with a link to a webpage about each product line they are interested in.

The company property is called “product_line” and the options are setup like product_line_1:1 (label:value).

When I get company.product_line via HUBL, I’m given a csv output of the labels like “product_line_1, product_line_5”, but what I want is to get the values and then loop through them with an if statement like if value = 1, show link to product_line_1 webpage…

Can anyone shed some light on how to loop through the values of multiple checkboxes?

Thank you!!

0 Upvotes
2 Replies 2
Dadams
HubSpot Employee
HubSpot Employee

HUBL Get Values from Multiple Checkbox Field on Company Then Loop

Properties with multiple options will be rendered as strings, with each option separated by a comma. You can use the split HubL Filter to split the options into a list of strings, then loop through that resulting list.

HubL supported filters

Filters affect the ultimate output of your HubL. They can be applied to various HubL statements and expressions to alter the template markup outputted by the server.

0 Upvotes
PDeT
Participant

HUBL Get Values from Multiple Checkbox Field on Company Then Loop

FYI, this is not possible, checkbox (single and multiple value) are of a certain variable type VarPassThroughReplacer which makes them immune for filters and even impossible to compare as strings even. It's mad...

0 Upvotes