
Announcements
Hello,
I want to add a if condition on the 1:N entity. For example If a customer has 10 orders than place the separate <p> section if he/she has less that 10 orders than place the following <p> block in email template. I was actually struggling getting the number of rows.
Can anyone help me with that ?
{{#if (gte contact.cra04_orders_contact_cra04_contactorders.Count 10)}}
<div class="col-md-12 col-lg-12 col-sm-12">
<p> It seems like that you haven't placed any order yet. If you are facing any issue than please do let us know. You can also click on the below link to report an issue. </p>
</div>
{{/if}}
Right now I am using this code but its wrong and not working. What is the right way to do that ?
Thanks,
Omer
Hi Omer,
The count cannot be used in the code block.
It is recommended to create a custom field in Contact entity, which records the count of orders. You can set the Field Type of the field as Rollup.
Edit its rule as the following screenshot.
The default recurrence of the rollup calculation is 1 hour. You can change this with following steps:
After creating the field, you can insert the code block into the marketing email.
The code snippet is something like:
{{#if (gte contact.new_countoforders 10)}}
It seems like that you haven't placed any order yet. If you are facing any issue than please do let us know. You can also click on the below link to report an issue.
{{else if (lt contact.new_countoforders 10)}}
test
{{/if}}
And here is my test result.