# If statement based on company field

**URL:** <https://community.hubspot.com/t/if-statement-based-on-company-field/98101>\
**Category:** CMS Development\
**Tags:** enterprise\
**Created:** [January 18, 2024, 11:18am UTC](https://community.hubspot.com/t/if-statement-based-on-company-field/98101 "2024-01-18T11:18:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EvaUR](https://avatars.discourse-cdn.com/v4/letter/e/6a8cbe/32.png) [@EvaUR](https://community.hubspot.com/u/EvaUR)\
**Post date:** [January 18, 2024, 11:18am UTC](https://community.hubspot.com/t/if-statement-based-on-company-field/98101/1 "2024-01-18T11:18:12Z")

</div>

I’m tried to make sure that a certain banner is only shown if a company is still active. I feel like the code below should work, but instead it always shows the banner, even if a company is set to inactive. Would should I change to make this work?

{% if company.storestatus == ‘Active’ %}  
\<div style=“max-width: 80%;”\>\<p\>{{company.storestatus}}\</p\>\<a href=“{{company.storeurl}}”\>\<left\>\<img src=“{{company.storelogourl}}” alt=“Company Store Logo” width=“80%” height=“auto”\>\</left\>\</a\>  
\</div\>  
{% endif %}

---

<div class="post-metadata">

**Author:** ![Anton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/anton/32/103167_2.png) [@Anton](https://community.hubspot.com/u/Anton)\
**Post date:** [January 18, 2024, 9:29pm UTC](https://community.hubspot.com/t/if-statement-based-on-company-field/98101/2 "2024-01-18T21:29:51Z")

</div>

Hi @EvaUR,  
the code looks

just to make sure:

- The property is a dropdown/radio-buttons - not a checkbox?
- The values are capitalized(first option in screenshot)

 ![Bildschirmfoto 2024-01-18 um 22.21.42.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/6/4/64efcf6130ff901bdfc2529985a07e9bbca1fd44.png)

- You’re previewing the page with a contact that has an (in)active status set in the CRM

 ![Bildschirmfoto 2024-01-18 um 22.23.14.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/a/1/a12fae60763d79e0e7cfe5a8d062d5077be99309.png)

If it’s a checkbox the code should look like this:

```lia-code-sample
{% if company.storestatus == 'yes' %}
<div style="max-width: 80%;"><p>{{company.storestatus}}</p><a href="{{company.storeurl}}"><left><img src="{{company.storelogourl}}" alt="Company Store Logo" width="80%" height="auto"></left></a>
</div>
{% endif %}

```

If you’re using a dropdown/radio with lowercase values the code should look like this

```lia-code-sample
{% if company.storestatus == 'active' %} {# or "inactive" #}
<div style="max-width: 80%;"><p>{{company.storestatus}}</p><a href="{{company.storeurl}}"><left><img src="{{company.storelogourl}}" alt="Company Store Logo" width="80%" height="auto"></left></a>
</div>
{% endif %}

```

The reason for the last one is: the page-builder will always display everything regardless of your if-statement(s)

best,

Anton
