CMS Development

Krum
Member

Checkbox propery value if comparison

SOLVE

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.

Krum_0-1632726633523.pngKrum_1-1632726643621.pngKrum_2-1632726682126.png

Krum_4-1632728180884.png

 

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.

0 Upvotes
1 Accepted solution
Krum
Solution
Member

Checkbox propery value if comparison

SOLVE

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".

Krum_0-1632737112921.png

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

Krum_1-1632737191404.png

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

Krum_2-1632737320684.png

 

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.

View solution in original post

9 Replies 9
Krum
Solution
Member

Checkbox propery value if comparison

SOLVE

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".

Krum_0-1632737112921.png

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

Krum_1-1632737191404.png

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

Krum_2-1632737320684.png

 

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.

Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Checkbox propery value if comparison

SOLVE

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.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Checkbox propery value if comparison

SOLVE

@Krum ,

 

If it is for an email, please check if you have enabled the 'programmable email beta':
Schermafbeelding 2021-09-27 om 10.24.00.png

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



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
Krum
Member

Checkbox propery value if comparison

SOLVE

@Teun 

Krum_3-1632731413371.png

 

Krum_0-1632731274543.png =>Krum_1-1632731280632.png

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

 

 

0 Upvotes
Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Checkbox propery value if comparison

SOLVE

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.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Checkbox propery value if comparison

SOLVE

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.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Checkbox propery value if comparison

SOLVE

@Krum ,

 

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



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


Krum
Member

Checkbox propery value if comparison

SOLVE

Hi @Teun,

Here is the result:

Krum_1-1632730479957.png

 

Krum_0-1632730458693.png

 

0 Upvotes
Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Checkbox propery value if comparison

SOLVE

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? 



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes