Goal
Show a section of an email only while a coupon list still has codes, and show other content when the list is empty.
Background Information
If a coupon list runs out of codes during sendout, some recipients do not receive a code. The setting Display Alternative Text replaces the coupon itself with a short text. With InsertIf rules, you can go further and replace whole sections, for example the instructions for redeeming the code.
The rules use the function ecx:isEmptyCouponList. It checks whether the coupon list still contains codes. For details, see Verify Existing Values.
Prerequisites
The coupon list uses the setting Display Alternative Text. With Pause Sendout, the sendout stops when the list runs out, so the content for an empty list is not used. See Create and Manage Coupon Lists.
You know how InsertIf rules work. See Personalization Rules.
Procedure
Create or edit an email message and open its HTML code.
Mark the content for recipients who receive a code with the rule
== 'false'(the list is not empty).Mark the content for recipients without a code with the rule
== 'true'(the list is empty).In both rules, replace
welcomecouponwith the name of your coupon list.Save the message.
Example:
<%InsertIf expression="${(ecx:isEmptyCouponList(coupon['welcomecoupon']) == 'false')}"%>
Your personal code: <%coupon.welcomecoupon%>
<%/InsertIf%>
<%InsertIf expression="${(ecx:isEmptyCouponList(coupon['welcomecoupon']) == 'true')}"%>
This offer is no longer available. Check out our latest deals.
<%/InsertIf%>Combine With Other Conditions
You can combine the check with other conditions. The following rule shows the alternative content if the list is empty or if the contact is already a customer (custom attribute Customer is true):
<%InsertIf expression="${(ecx:isEmptyCouponList(coupon['welcomecoupon']) == 'true') or (user.CustomAttribute['Customer'] == 'true')}"%>
Alternative content
<%/InsertIf%>Additional Information
Looking for a structured learning path?
Learn step by step in our Academy Course: Mapp Engage - Personalization Rules.
Test messages and previews do not use real codes. They show the preview text of the coupon list. If no preview text is set, Mapp Engage shows the list name followed by
_previewCoupon, for examplewelcomecoupon_previewCoupon.To insert the coupon itself, see Add a Coupon to a Message.
.png)