--- title: "Adapt Message Content Based on Coupon Availability" slug: "show-message-parts-using-available-coupons" description: "Show content in a Mapp Engage email only while a coupon list has codes, and other content when it is empty, with InsertIf rules." status: "update" updated: 2026-11-04T10:44:01Z published: 2026-11-04T10:44:01Z canonical: "docs.mapp.com/show-message-parts-using-available-coupons" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.mapp.com/llms.txt > Use this file to discover all available pages before exploring further. # Adapt Message Content Based on Coupon Availability ## 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](/v1/docs/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](/v1/docs/managing-coupon-lists). - You know how InsertIf rules work. See [Personalization Rules](/v1/docs/personalization-rules-insertif-insertelse). --- ## Procedure 1. Create or edit an email message and open its HTML code. 2. Mark the content for recipients who receive a code with the rule `== 'false'` (the list is not empty). 3. Mark the content for recipients without a code with the rule `== 'true'` (the list is empty). 4. In both rules, replace `welcomecoupon` with the name of your coupon list. 5. Save the message. Example: ```plaintext <%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`): ```plaintext <%InsertIf expression="${(ecx:isEmptyCouponList(coupon['welcomecoupon']) == 'true') or (user.CustomAttribute['Customer'] == 'true')}"%> Alternative content <%/InsertIf%> ``` --- ## Additional Information > [!TIP] > ![](https://cdn.document360.io/554b9b98-6720-4d8b-9919-c7b203d72648/Images/Documentation/grafik(33).png) > > Looking for a structured learning path? > > Learn step by step in our Academy Course: [Mapp Engage - Personalization Rules](https://academy.mapp.com/catalog/courses/2783025). - 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 example `welcomecoupon_previewCoupon`. - To insert the coupon itself, see [Add a Coupon to a Message](/v1/docs/add-coupons-to-a-message).