Default value with custom module

SOLVE
Highlighted
New Contributor

I made custom module on Design manager. It uses contact property and replace with default value property is not set (blank). Tried 2 implementation case but could not work.

output of code is blank.

 

 

case 1

       <td style="width: 50%; padding-right: 14px; text-align: left; font-size: 12px; padding-bottom: 30px; line-height: 1.5em;" valign=top class="k-480-col mk-padding">
         <a href="{{ contact.booking_recomended_listing_1_url|default('example.com') }}">
           <img src="{{ contact.booking_recomended_listing_1_image|default('example.jpg', true) }}" style="width: 296px; height: 180; object-fit: contain; border: none;" width="{{ widget.image_left.width }}"  alt="{{ widget.image_left.alt }}">
           <h2 style="font-size: 14px; margin-top: 15px;">{{ contact.booking_recomended_listing_1_name|default('example name', true) }}</h2>  
           {{ contact.booking_recomended_listing_1_access|default('example text', true) }}  
         </a>
      </td>

 

case 2

         <td style="width: 50%; padding-left: 14px; text-align: left; font-size: 12px; padding-bottom: 30px; line-height: 1.5em;" valign=top class="k-480-col k-480-padding">
        {% if contact.booking_recomended_listing_2_url != "CONTACT.BOOKING_RECOMENDED_LISTING_2_URL" %}
        <a href="{{contact.booking_recomended_listing_2_url}}">
          <img src="{{contact.booking_recomended_listing_2_image}}" style="width: 296px; height: 180; object-fit: contain; border: none;" width="{{ widget.image_left.width }}"  alt="{{ widget.image_right.alt }}">
        </a>
        <h2 style="font-size: 14px; margin-top: 15px;"><a href="{{contact.booking_recomended_listing_1_url}}">{{ contact.booking_recomended_listing_2_name }}</a></h2>  
        {{ contact.booking_recomended_listing_2_access }}
        {% else %}
        <a href="example.com">
          <img src="example.JPG" style="width: 296px; height: 180; object-fit: contain; border: none;" width="{{ widget.image_left.width }}"  alt="{{ widget.image_left.alt }}">
        </a>
        <h2 style="font-size: 14px; margin-top: 15px;"><a href="example.com">example name</a></h2>
        example text
        {% endif %}
      </td>

 

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Top Contributor

Hey there!

 

Since you're dealing with contact properties, I think your best best is to set up personalization token defaults rather than setting defaults in the HubL markup

 

Here is an knowledge base article that will walk you through setting those up:

https://knowledge.hubspot.com/articles/kcs_article/email/how-do-i-create-default-values-for-my-perso...

2 Replies 2
Top Contributor

Hey there!

 

Since you're dealing with contact properties, I think your best best is to set up personalization token defaults rather than setting defaults in the HubL markup

 

Here is an knowledge base article that will walk you through setting those up:

https://knowledge.hubspot.com/articles/kcs_article/email/how-do-i-create-default-values-for-my-perso...

New Contributor

Thank you. Resolved with that.

Reply
0 Upvotes