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.
@BérangèreL , 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.
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:
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?
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 %}
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.
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.
@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.