# TEMPLATE\_RENDERING\_FAILED when wrapping a custom module with a conditional statement

**URL:** <https://community.hubspot.com/t/template-rendering-failed-when-wrapping-a-custom-module-with-a-conditional-statement/62701>\
**Category:** CMS Development\
**Tags:** email\
**Created:** [August 10, 2022, 10:25am UTC](https://community.hubspot.com/t/template-rendering-failed-when-wrapping-a-custom-module-with-a-conditional-statement/62701 "2022-08-10T10:25:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ASouy](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@ASouy](https://community.hubspot.com/u/ASouy)\
**Post date:** [August 10, 2022, 10:25am UTC](https://community.hubspot.com/t/template-rendering-failed-when-wrapping-a-custom-module-with-a-conditional-statement/62701/1 "2022-08-10T10:25:18Z")

</div>

Dear HubSpot team,

I am having trouble sending test email when wrapping a module in a conditional statement:

```lia-code-sample
{% if contact.product_for_email_1__c != 'None' %}
 {% module "module_165944613959018" path="/XXXX/Product card", label="Product card" value={{ contact.product_for_email_1__c }} %}
{% endif %}

```

On the email live preview, the logic is working fine but when I try to send an test email, I got the following error:

`{errorMessage: "Content public api error: portalId: 26081264, path: internal/simple-render/for-html, response: CachingHttpResponse{statusCode=400, body=<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/>\n<title>Error 400 Bad Request</title>\n</head>\n<body><h2>HTTP ERROR 400</h2>\n<p>Reason:\n<pre> Bad Request</pre></p>\n</body>\n</html>\n}" eventId: null ready: true sendResult: null sendStatus: "TEMPLATE_RENDERING_FAILED"}`

The content of the custom module is only “Hi”.

If I change the code to

```lia-code-sample
{% if contact.product_for_email_1__c != 'None' %}
 Hi
{% endif %}

```

The emails preview is fine and I can send test email.

Also, if I try to embedded the logic into the module, the module is always printing Hi, even though module.value = ‘None’. I can send test email though.

```lia-code-sample
{% if module.value != 'None' %}
Hi
{% endif %}

```

Maybe it’s linked to the fact that contact.product\_for\_email\_1\_\_c is a custom property synced from Salesforce?

![Property-settings.png](https://d2qpr2jzcazej7.cloudfront.net/optimized/3X/e/a/ea33cbeadcf5c3e99748e0995f7c53b8b9970ec4_2_690x30.png)

Could you please advise.

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [August 10, 2022, 11:37pm UTC](https://community.hubspot.com/t/template-rendering-failed-when-wrapping-a-custom-module-with-a-conditional-statement/62701/2 "2022-08-10T23:37:45Z")

</div>

Hi, @ASouy 👋 Thanks for reaching out. Let’s see if we can get the conversation started. @Anton @Jnix284 @assi do you have any experience with the issue @ASouy is describing?

Best,

Jaycee

---

<div class="post-metadata">

**Author:** ![ASouy](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@ASouy](https://community.hubspot.com/u/ASouy)\
**Post date:** [August 11, 2022, 9:09am UTC](https://community.hubspot.com/t/template-rendering-failed-when-wrapping-a-custom-module-with-a-conditional-statement/62701/3 "2022-08-11T09:09:10Z")

</div>

Dear Jaycee,

As a workaround, I set a variable with the custom property and the conditional statement are working fine 🙈

 ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/d/e/de97c07d21bf9f8846adf7690223b28612b18403.png)

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [August 17, 2022, 11:15pm UTC](https://community.hubspot.com/t/template-rendering-failed-when-wrapping-a-custom-module-with-a-conditional-statement/62701/4 "2022-08-17T23:15:35Z")

</div>

Hey, @ASouy, thank you very much for coming back and adding what worked for you 🙌
