I'm creating a custom form-module and wants to show form A when the custom "Business Unit newsletter" property contains Business Unit A. When the property is empty or only filled with Business Unit B or C, then show form B (else-statement).
The "Business Unit newsletter" property is a multi-select with 3 values of Business Units.
So i started the if statement with:
{% if contact.newsletter_business_unit.value == 'BU-A' %}
But this does not work.
Also tried:
- {% if contact.newsletter_business_unit is containing 'BU-A' %} => does not work
- {% if contact.newsletter_business_unit %} => if any value is filled, the right form (form A) is displayed, otherwise form B.
- {{ if contact.newsletter_business_unit.value|pprint }} => NULL
@PKemps got it, yeah i've run into that same issue before and did exactly what you've done with the delay. So i think you don't need .value in your if statement, i think it should look something like this. I test this with a test dropdown and it seemed to work
{% if contact.newsletter_business_unit == "Replace with Property Label" %}
Hi @PKemps, you might be able to create a few smart rules to display the form based on the logic. Create a few lists that meet the filter criteria of the business unit newsletter property and then display the specific form in the rules.
Also I'm not 100% sure how the contact value if statment works but what you have written should technically work. Maybe double check the value matches the internal value and not the selector value.
I first worked with smart modules, but the "smart" is not fast enough to show the correct form. In the footer of our website (alfen.com) is a registration form and it asks which Business Unit you want to receive newsletters from. Based on that property, a form is used on the thank you page and the smart module does not work then because the contact is not yet in the correct list. The second i tried was to delay the thank you page to display but that is not a elegant and user-friendly way. So i trying to do this with a HubL if-statement.
@PKemps got it, yeah i've run into that same issue before and did exactly what you've done with the delay. So i think you don't need .value in your if statement, i think it should look something like this. I test this with a test dropdown and it seemed to work
{% if contact.newsletter_business_unit == "Replace with Property Label" %}