Help with Programmable Email

SStrachan
Participant

I am trying to build a workflow to pass a query into a programmable email.

 

I can pass the query into a landing page, but not the email.

 

Please watch here for a quick example: https://capture.dropbox.com/XW54OjzPCGlB2sq6

Code example: 

 

{% set price_from = request.query_dict.price_from %}
{% set price_to = request.query_dict.price_to %}
<h2> Price From: {{ price_from }}</h2>
<h2> Price To: {{ price_to }}</h2>
<br><br>

{% set yacht = crm_objects("yacht") %}
{% set single_contact = crm_objects("yacht",'limit=600', 'name,yearbuilt,loaft,featuredimagesalesurl,featuredimagesales1url,featuredimagesales2url,featuredimagesales3url,featuredimagesales4url,featuredimagesales5url,featuredimagesales6url,featuredimagesales7url,featuredimagesales8url,price') %}
<!-- {# yacht #} -->
<br>
<br>
<br>
{% for single in single_contact.results %}
   {% if single.price|int >=price_from|int and single.price|int <=price_to|int  %}
    <div class="yatch_deatil_section">
           <div class="yatch_img">
             {% if  single.featuredimagesalesurl  %}
                  <img src="{{ single.featuredimagesalesurl }}" style="width:100%">
             {% else %}
                 <img src="https://f.hubspotusercontent40.net/hubfs/21272746/not-found.png" style="width:100%">
             {% endif %}
          </div>
      <div class="yatch_info">
        <p><strong>Yatch Name</strong> : {{ single.name }}</p>
        <p><strong>Loaft</strong> : {{ single.loaft }}</p>
          <p><strong>Yearbuilt</strong> : {{ single.yearbuilt }}</p>
         <p><strong>Price</strong> : {{ single.price }}</p>
      </div>

    </div>
   {% endif %}
{% endfor %}
<br>

 

 

0 Upvotes
1 Accepted solution
KimM
Solution
Top Contributor

So I'm still relatively new to the programmable emails stuff, but I think your issue will have to do with the fact that you're trying to pull a URL query in an email.

 

It's not fully clear exactly what you've already got set up, but I'm guessing that you want to send an email with results based on a form completion on the site. So you would need to assign the URL query values to a contact property for each or you can query it from a custom object and then pull those properties within the email itself.

 

The 'Custom Object' section of this article might help if you go down that route.

 

But if you're assigning the contact properties you could just simply use the contact tokens like so:

{% set price_from = contact.price_from %}
{% set price_to = contact.price_to %}
<h2> Price From: {{ price_from }}</h2>
<h2> Price To: {{ price_to }}</h2>
<br><br>

 

I didn't dig into the rest of the code as it seems like the main issue was that you couldn't pull those values in. Once you get that bit right you'll be able to test the rest of the code.

View solution in original post

3 Replies 3
TJensen23
Member

yes awesome

0 Upvotes
KimM
Solution
Top Contributor

So I'm still relatively new to the programmable emails stuff, but I think your issue will have to do with the fact that you're trying to pull a URL query in an email.

 

It's not fully clear exactly what you've already got set up, but I'm guessing that you want to send an email with results based on a form completion on the site. So you would need to assign the URL query values to a contact property for each or you can query it from a custom object and then pull those properties within the email itself.

 

The 'Custom Object' section of this article might help if you go down that route.

 

But if you're assigning the contact properties you could just simply use the contact tokens like so:

{% set price_from = contact.price_from %}
{% set price_to = contact.price_to %}
<h2> Price From: {{ price_from }}</h2>
<h2> Price To: {{ price_to }}</h2>
<br><br>

 

I didn't dig into the rest of the code as it seems like the main issue was that you couldn't pull those values in. Once you get that bit right you'll be able to test the rest of the code.

MiaSrebrnjak
Community Manager
Community Manager

Hi @SStrachan,

 

Thank you for the video! I'm not familiar with programmable emails, but I found this Community post that might be helpful.  

 

I also wanted to ask @KimM@Indra@JBeatty@lynton for their help & insights - do you maybe know why the custom properties aren't displayed in the email? Thank you!

 

 

Cheers
Mia, Community Team


loop Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.
Learn More