Checkbox propery value if comparison

HI,

I have a problem accessing and comparing the value of custom property for contact.

I have created both Multiple checkbox and single property for a contact.

I can not get a correct if statement to get the proper value comparison.

I am missing something I checked the documentation and copied directly some of the statements but it still results in wrong comparison.

Thanks.

Hi @Krum ,

If you retrieve a contact property using HubL, it will return the label instead of the value. This is because of the fact that HubSpot assumes that you want to use it in an email or some sort. So your if statements should check on the label and not the value.

Sorry, I read this wrong. You tried using an if statement on the label, but it doesn’t work. I’ll do some tests to see if I can find a solution.

@Krum ,

Could you try {{contact.test_krum|pprint}} and send us the result?

Hi @Teun,

Here is the result:

Krum_0-1632730458693.png

Hi @Krum ,

Could you try this (I know it is in your test code allready, just copy and try it):

{% if contact.test_krum == 'No' %}
 Show something
{% else %}
 Show something else
{% endif %}

What kind of module are you creating? Is it for an email?

@Krum ,

If it is for an email, please check if you have enabled the ‘programmable email beta’:

You can set this in the ‘Design Tools’ when you click on your module.

@Teun


=>

And I have enabled programmable emails. That is exactly what I am trying to get to work:

Hi @Krum ,

This seems like a major bug. Could you give feedback through the button?

For now, you could create a hacky workaround by creating a second property named ‘test_krum_text’ of the type single line text. If you create a contact workflow with the trigger on the test_krum property, you could use that workflow to set test_krum_text and use test_krum_text in your modules if statement.

I found the issue!
The problem was that I had another module used in the template which was not enabled for programmable emails and the button to enable programmable emails was missing because the module had template type “All”.

I had to deselect one of the options for the template types to see the enable switch:

Then select again the option if the component is to be used in all template types.

All the modules in the same template need to have programmable emails enabled to be able to use the if statements correctly otherwise just the labels are available but not comparable. It was the same with the single line text property.