# How to hide a TR based on a module variable containing a token

**URL:** <https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453>\
**Category:** CMS Development\
**Created:** [November 28, 2025, 1:06am UTC](https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453 "2025-11-28T01:06:39Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jopitts](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jopitts/32/44643_2.png) [@Jopitts](https://community.hubspot.com/u/Jopitts)\
**Post date:** [November 28, 2025, 1:06am UTC](https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453/1 "2025-11-28T01:06:39Z")

</div>

All,

I’m trying to work out what dumb thing I’m doing here.

I have the following code in my table:

```lia-code-sample
{% if module.job_title != "hide" %}
 <tr>
 <td style="color:inherit; font-family:inherit; ">
 {% inline_text field="job_title" value="{{ module.job_title }}" %}
 </td>
 </tr>
 {% endif %}

```

I have a variable defined in my module (job\_title) which by default contains the following:

`{{ personalization_token('contact.hubspot_owner_id.hs_job_title', 'hide') }}`

However, I am getting the row showing up with the word ‘hide’ in it.

How can I hide the TR based on the value of the variable, when the variable contains a personalisation token?

---

<div class="post-metadata">

**Author:** ![Jopitts](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jopitts/32/44643_2.png) [@Jopitts](https://community.hubspot.com/u/Jopitts)\
**Post date:** [November 28, 2025, 3:12am UTC](https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453/2 "2025-11-28T03:12:49Z")

</div>

All,

FWIW - Have tried this variant with no luck.

I have this code in my module:

```lia-code-sample
 {% if module.job_title != 'OWNER.HS_JOB_TITLE' %}
 <tr>
 <td style="color:inherit; font-family:inherit; ">
 {{ module.job_title }}
 </td>
 </tr>
 {% endif %}

```

And for the job\_title variable, I have now just set it to:

`{{ contact.hubspot_owner_id.hs_job_title }}`

I still see the row, only with ‘OWNER.HS\_JOB\_TITLE’ in it.

Cheers

Jo

---

<div class="post-metadata">

**Author:** ![Berangere](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/berangere/32/220784_2.png) [@Berangere](https://community.hubspot.com/u/Berangere)\
**Post date:** [November 28, 2025, 10:17am UTC](https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453/3 "2025-11-28T10:17:17Z")

</div>

Hi @Jopitts and Happy Friday! 🙌

Thank you so much for reaching out to the HubSpot Community and for sharing the code you used.

I’ve gathered some helpful resources on this topic for you:  
- [HubL filters](https://developers.hubspot.com/docs/cms/reference/hubl/filters)  
- [If statements](https://developers.hubspot.com/docs/cms/reference/hubl/if-statements)  
- [HubL functions](https://developers.hubspot.com/docs/cms/reference/hubl/functions)  
Let’s also check in with our wonderful Top Experts: Hi @Anton, [@sylvain\_tirreau](https://community.hubspot.com/t5/user/viewprofilepage/user-id/601366) and @SteveHTM do you have any suggestions or tips to help @Jopitts, please?  
Thank you all for your support, and wishing everyone a fantastic weekend!  
Bérangère

---

<div class="post-metadata">

**Author:** ![Jopitts](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jopitts/32/44643_2.png) [@Jopitts](https://community.hubspot.com/u/Jopitts)\
**Post date:** [November 28, 2025, 5:36pm UTC](https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453/4 "2025-11-28T17:36:21Z")

</div>

[@BérangèreL](https://community.hubspot.com/t5/user/viewprofilepage/user-id/230185) , thanks for replying. There is a lot of interesting info in those links and I really appreciate you sending them through, but nothing in there gets me over the line sadly.  
Hopefully I’ll get something back from one of the experts.

Cheers

Jo

---

<div class="post-metadata">

**Author:** ![Jopitts](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jopitts/32/44643_2.png) [@Jopitts](https://community.hubspot.com/u/Jopitts)\
**Post date:** [November 28, 2025, 7:24pm UTC](https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453/5 "2025-11-28T19:24:56Z")

</div>

All,

I’ve further simplified things, but with no better outcome. I’m no longer using a module variable, just embedding the personalisation token directly into my code:

```lia-code-sample
{% set showRow = personalization_token('contact.hubspot_owner_id.hs_main_phone', 'hide') %}
 {% if showRow != "hide" %}
 <tr>
 <td style="color:inherit; font-family:inherit; ">
 <span style="font-weight:700">P </span>
 <a style="text-decoration:none; color:inherit; font-family:inherit; " href="tel:{{ contact.hubspot_owner_id.hs_main_phone }}">{{ contact.hubspot_owner_id.hs_main_phone }}</a>
 <span>showRow: {{showRow}}</span>
 </td>
 </tr>
 {% endif %}

```

And this is my output

![Jopitts_0-1764357811116.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/f/4fb802a3e05840bc95a242c1e6cf9b014cac06e9.png)

Given the if statement should only allow this to be displayed when the value of showRow is not hide, why on earth is it showing it when the value of showRow clearly **IS** hide?

Cheers

Jo

---

<div class="post-metadata">

**Author:** ![Christensen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/christensen/32/24543_2.png) [@Christensen](https://community.hubspot.com/u/Christensen)\
**Post date:** [December 2, 2025, 2:01pm UTC](https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453/6 "2025-12-02T14:01:35Z")

</div>

Hey @Jopitts , I think the issue is that personalization\_token() isn’t outputting a plain string, while your comparison is checking against a literal string “hide”. This type mismatch would explain why the condition evaluates incorrectly even though it displays as “hide”.

Try adding the |string filter to convert the token output to a comparable string:

`{% set showRow = personalization_token('contact.hubspot_owner_id.hs_main_phone', 'hide')|string %}`

---

<div class="post-metadata">

**Author:** ![Jopitts](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jopitts/32/44643_2.png) [@Jopitts](https://community.hubspot.com/u/Jopitts)\
**Post date:** [December 2, 2025, 6:08pm UTC](https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453/7 "2025-12-02T18:08:31Z")

</div>

@Christensen , I’d already tried that. Still no luck. This code snippet in it’s current state:

```lia-code-sample
{% set showRow = personalization_token('contact.hubspot_owner_id.hs_main_phone', 'hide')|string %}
 {% if showRow != 'hide' %}
 <tr>
 <td style="color:inherit; font-family:inherit; ">
 <span style="font-weight:700">P </span>
 <a style="text-decoration:none; color:inherit; font-family:inherit; " href="tel:{{ showRow }}">{{ showRow }}</a>
 </td>
 </tr>
 {% endif %}

```

Any other thoughts?

Cheers

Jo

---

<div class="post-metadata">

**Author:** ![Jopitts](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jopitts/32/44643_2.png) [@Jopitts](https://community.hubspot.com/u/Jopitts)\
**Post date:** [December 5, 2025, 1:38am UTC](https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453/8 "2025-12-05T01:38:35Z")

</div>

@Christensen ,

More updates. It turns out, my lack of knowledge meant I wasn’t pulling the contact data correctly (and I may still not be).

My code now looks like this:

```lia-code-sample
{% set showRow = contact_owner.additional_phone|replace(" ", "") %}
 {% if showRow && showRow != '' %}
 <tr>
 <td style="color:inherit; font-family:inherit; ">
 <span style="font-weight:700">C </span>
 <a style="text-decoration:none; color:inherit; font-family:inherit; " href="tel:{{ showRow }}">||{{ showRow }}||</a>
 length: {{ showRow|length }}
 </td>
 </tr>
 {% endif %}

```

The output looks like this:

| C |||| length: 26 |
| --- |

why is the length showing as 26? And if the length is 26, how are there no gaps between the || symbols I’ve prefixed and suffixed the output with?

Where are the HUBL experts?  
I must be doing something very silly, and it seems no one in the community can tell me what, which is astounding beyond belief.

---

<div class="post-metadata">

**Author:** ![Christensen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/christensen/32/24543_2.png) [@Christensen](https://community.hubspot.com/u/Christensen)\
**Post date:** [December 5, 2025, 5:24am UTC](https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453/9 "2025-12-05T05:24:45Z")

</div>

Hey @Jopitts , I was so sure that I replied to you but it looks like I missed my opportunity to send my last

Anyway, this happens because it’s counting the characters from the object that was returned from contact\_owner.additional\_phone|replace(" ", “”). What you need is the actual value of a property to make the comparison.

Upon digging around and testing HubL in the email editor, it looks like that you can’t use the personalization\_token for comparison because it loads AFTER the HubL logic therefore the long length.

As a workaround, you can create a HubSpot email module with programmable email turned on for this then use the direct reference to the property without the personalization\_token function which will render the value before the HubL logic.

I also don’t think the contact\_owner.additional\_phone is a valid property reference nor contact.hubspot\_owner\_id.hs\_main\_phone but I know that contact.hubspot\_owner\_id.firstname and contact.hubspot\_owner\_id.lastname is a valid property references.

This is now beyond an email personalization and would fall in the custom email module development work.

---

<div class="post-metadata">

**Author:** ![Jopitts](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jopitts/32/44643_2.png) [@Jopitts](https://community.hubspot.com/u/Jopitts)\
**Post date:** [December 5, 2025, 6:05pm UTC](https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453/10 "2025-12-05T18:05:24Z")

</div>

@Christensen , this is a custom email module. It contains HTML and HUBL.

I’m not using the personalisation token approach, but just the direct contact properties (you can see from the code that I am going direct to contact\_owner.\<property\> rather than the personalization approach).

I will try turning the programmable email on regardless, and let you know the outcome.

Cheers

Jo

---

<div class="post-metadata">

**Author:** ![Jopitts](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jopitts/32/44643_2.png) [@Jopitts](https://community.hubspot.com/u/Jopitts)\
**Post date:** [December 5, 2025, 6:20pm UTC](https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453/11 "2025-12-05T18:20:43Z")

</div>

@Christensen , turns out that turning on the programmable email option solved things. It radically changed the way HUBL interpreted object properties.

Thanks for the help!! It’s much appreciated

Cheers

Jo

---

<div class="post-metadata">

**Author:** ![Berangere](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/berangere/32/220784_2.png) [@Berangere](https://community.hubspot.com/u/Berangere)\
**Post date:** [December 8, 2025, 1:28pm UTC](https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453/12 "2025-12-08T13:28:36Z")

</div>

Great to hear, @Jopitts! Thanks for sharing your solution, this will be helpful to others.  
If you have more questions, feel free to ask!  
Have a lovely day!  
Bérangère

---

<div class="post-metadata">

**Author:** ![Jopitts](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jopitts/32/44643_2.png) [@Jopitts](https://community.hubspot.com/u/Jopitts)\
**Post date:** [December 2, 2025, 6:34pm UTC](https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453/13 "2025-12-02T18:34:17Z")

</div>

@Christensen , I’ve extended my code a little further in the hunt for answers. This is the current state:

```lia-code-sample
 {% set showRow = personalization_token('contact.hubspot_owner_id.hs_main_phone', 'hide')|string %}
 {% if showRow != 'hide' %}
 <tr>
 <td style="color:inherit; font-family:inherit; ">
 <span style="font-weight:700">P </span>
 <a style="text-decoration:none; color:inherit; font-family:inherit; " href="tel:{{ showRow }}">{{ showRow }}</a>
 <p>
 Data on showRow: {{ showRow|pprint }}
 </p>
 </td>
 </tr>
 {% endif %}

```

This is the current output:

P hide

Data on showRow: (String: {“objectExpression”:“contact\_without\_defaults.hubspot\_owner\_id.hs\_main\_phone”,“defaultExpression”:“contact.hubspot\_owner\_id.hs\_main\_phone”,“localDefault”:“hide”})

I was surprised by this as it indicates that showRow is still not being seen as a string.

Thoughts?

---

<div class="post-metadata">

**Author:** ![Jopitts](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jopitts/32/44643_2.png) [@Jopitts](https://community.hubspot.com/u/Jopitts)\
**Post date:** [December 1, 2025, 5:34pm UTC](https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453/14 "2025-12-01T17:34:48Z")

</div>

[@BérangèreL](https://community.hubspot.com/t5/user/viewprofilepage/user-id/230185) , any thought on any other experts who could weigh in? This can’t be that hard of a question for someone to help out with.

---

<div class="post-metadata">

**Author:** ![Berangere](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/berangere/32/220784_2.png) [@Berangere](https://community.hubspot.com/u/Berangere)\
**Post date:** [December 2, 2025, 11:54am UTC](https://community.hubspot.com/t/how-to-hide-a-tr-based-on-a-module-variable-containing-a-token/143453/15 "2025-12-02T11:54:12Z")

</div>

Hi @Jopitts and thanks for getting back to us!  
Please note that our forum is a peer-to-peer support forum and all of our members are volunteers.  
The issue here seems to be with the personalization\_token() that returns the actual value when the contact is known, not the default “hide” string.  
Could you please check if the value is empty or equals the default instead or use an empty string check to see if that helps.  
Here is a documentation that might help: “[HubL functions](https://developers.hubspot.com/docs/cms/reference/hubl/functions)”.  
Now let’s consult with our Top Experts: Hi @tmcginnis, @Christensen and @RubenBurdin can you think of other suggestions to help @Jopitts, please?  
Thanks so much for your help and have a lovely day!  
Bérangère
