HubL uses if statements to help define the logic of a template. The syntax of HubL if statements is very similar to conditional logic in Python. If statements are wrapped in statement delimiters, starting with an opening if statement and ending with...
But it seems that when sending the email, the condition ignores the value of the variable.
Someone knows if it is possible and how?
Using Conditional Rendering(Hubl) in Email Template For Single Send API
This is currently not possible in HubSpot because of how the order of rendering occurs. When building the content in the emails, HubSpot compiles the HubL before using any contact or company variables. Once the document is compiled, HubSpot fills in any missing tokens. As such, when it reaches the if statement, the statement will evaluate as if the condition variable is null.
You can find more information below about HubL if statements and limitations
Using Conditional Rendering(Hubl) in Email Template For Single Send API
Hello,
I am following up on this with the same issue. We are trying to build an email payment receipt and with it a field for promotional discount. I am trying to use Hubl to place an if statement to hide or show that portion of the email. It doesn’t seem to pick up the value of the variable.