{"id":3876,"date":"2023-09-21T13:08:25","date_gmt":"2023-09-21T12:08:25","guid":{"rendered":"https:\/\/help.expertsender.com\/?post_type=es&#038;p=3876"},"modified":"2025-07-09T16:55:53","modified_gmt":"2025-07-09T15:55:53","slug":"deleterow","status":"publish","type":"es","link":"https:\/\/help.expertsender.com\/pl\/emp\/dynamic-content\/data-tables\/deleterow\/","title":{"rendered":"DeleteRow"},"content":{"rendered":"\n<p><code>DeleteRow<\/code> method can be used to delete a single row from custom data table. This is an equivalent of SQL <code>DELETE<\/code> query.<\/p>\n\n\n\n<p>It is best to be very careful with this method to avoid losing your data by accident. Deleting multiple rows is disabled, to avoid deleting whole tables by mistake.<\/p>\n\n\n\n<p>This method can be useful if it is necessary to delete records from your custom data when an email is sent. E.g. this may be a list of customers who did not received any offer or a list of unique offers that cannot be sent twice, etc.<\/p>\n\n\n\n<p><strong>1. Method signature<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#babed8;--cbp-line-number-width:7.703125px;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"DeleteRow(table, filters, filterOperator)\" style=\"color:#babed8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg  style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-palenight\" style=\"background-color: #292D3E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #82AAFF\">DeleteRow<\/span><span style=\"color: #BABED8\">(table<\/span><span style=\"color: #89DDFF\">,<\/span><span style=\"color: #BABED8\"> filters<\/span><span style=\"color: #89DDFF\">,<\/span><span style=\"color: #BABED8\"> filterOperator)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Parameter definition:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Name<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>Table<\/td><td>string<\/td><td>Required. Table name.<\/td><\/tr><tr><td>Filters<\/td><td>array of Filter objects<\/td><td>Optional. Array of objects defining elements of&nbsp;<code>WHERE<\/code>&nbsp;phrase of&nbsp;<code>DELETE<\/code>&nbsp;query. Use this parameter, to restrict deleting row only if it matches your criteria. If null, no criteria will be applied. If several filters are defined, by default, deleted row will match all of them (equivalent to logical&nbsp;<code>AND<\/code>). &nbsp;<br>Default behavior can be overridden using&nbsp;<code>filterOperator<\/code>&nbsp;parameter.<\/td><\/tr><tr><td>filterOperator<\/td><td>enumeration<\/td><td>Optional. Logical operator used for filters. Can be one of the following:AND (filter1 AND filter2 AND filter3&#8230;) &#8211; this is the default valueOR (filter1 OR filter2 OR filter3&#8230;)ANDNOT (NOT filter1 AND NOT filter2 AND NOT filter3&#8230;)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><code>Filter<\/code> object parameter definition:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Name<\/th><th>Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>Name<\/td><td>string<\/td><td>Column name<\/td><\/tr><tr><td>Modifier<\/td><td>enumeration<\/td><td>Operation modifier. Can be one of the following:<br>EQ (equals, &#8220;=&#8221;)GT (greater than, &#8220;&gt;&#8221;)LT (lower than, &#8220;&lt;&#8220;)LIKE (SQL&nbsp;<code>LIKE<\/code>&nbsp;operator)<\/td><\/tr><tr><td>Value<\/td><td>object<\/td><td>Column value. Value type depends on column type, e.g. when filtering by number column, integer value should be supplied, string for text columns etc. Simple type conversion is also supported, e.g. string &#8220;123&#8221; representing correct integer value 123 will be accepted. This also works for dates, floating point numbers etc.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Note: Filters work the same way as in <code>GetRows<\/code> method. See<a href=\"https:\/\/help.expertsender.com\/emp\/dynamic-content\/data-tables\/getrows\/\"> GetRows documentation<\/a> for more details and examples.<\/p>\n\n\n\n<p><strong>2. Usage and examples<\/strong><\/p>\n\n\n\n<p>You can call <code>DeleteRow<\/code> method using curly braces syntax. You may put in anywhere in the email template code since its output is empty string.<\/p>\n\n\n\n<p>Example 1 &#8211; the most simple call<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#babed8;--cbp-line-number-width:7.703125px;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"${DeleteRow('MyTable')}\" style=\"color:#babed8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg  style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-palenight\" style=\"background-color: #292D3E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #BABED8\">$<\/span><span style=\"color: #89DDFF\">{<\/span><span style=\"color: #82AAFF\">DeleteRow<\/span><span style=\"color: #F07178\">(<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #C3E88D\">MyTable<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #F07178\">)<\/span><span style=\"color: #89DDFF\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Equivalent SQL query:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#babed8;--cbp-line-number-width:7.703125px;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"DELETE TOP(1) FROM MyTable\" style=\"color:#babed8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg  style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-palenight\" style=\"background-color: #292D3E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #BABED8\">DELETE <\/span><span style=\"color: #82AAFF\">TOP<\/span><span style=\"color: #BABED8\">(<\/span><span style=\"color: #F78C6C\">1<\/span><span style=\"color: #BABED8\">) FROM MyTable<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>This however has limited use, since in most cases, you will want to delete a specific row (and not first found). Following examples show how to use filters to achieve this.<\/p>\n\n\n\n<p>Example 2 &#8211; deleting a row matching specified criteria<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#babed8;--cbp-line-number-width:7.703125px;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"${DeleteRow('MyTable', new [] {new Filter('CustomerId', EQ, 123)})}\" style=\"color:#babed8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg  style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-palenight\" style=\"background-color: #292D3E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #BABED8\">$<\/span><span style=\"color: #89DDFF\">{<\/span><span style=\"color: #82AAFF\">DeleteRow<\/span><span style=\"color: #F07178\">(<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #C3E88D\">MyTable<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #89DDFF\">,<\/span><span style=\"color: #F07178\"> <\/span><span style=\"color: #89DDFF\">new<\/span><span style=\"color: #F07178\"> [] <\/span><span style=\"color: #89DDFF\">{<\/span><span style=\"color: #F07178\">new Filter<\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #C3E88D\">CustomerId<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #89DDFF\">,<\/span><span style=\"color: #F07178\"> <\/span><span style=\"color: #BABED8; font-style: italic\">EQ<\/span><span style=\"color: #89DDFF\">,<\/span><span style=\"color: #F07178\"> 123<\/span><span style=\"color: #89DDFF\">)}<\/span><span style=\"color: #F07178\">)<\/span><span style=\"color: #89DDFF\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Equivalent SQL query:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#babed8;--cbp-line-number-width:7.703125px;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"DELETE TOP(1) FROM MyTable WHERE CustomerId = 123\" style=\"color:#babed8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg  style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-palenight\" style=\"background-color: #292D3E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #BABED8\">DELETE <\/span><span style=\"color: #82AAFF\">TOP<\/span><span style=\"color: #BABED8\">(<\/span><span style=\"color: #F78C6C\">1<\/span><span style=\"color: #BABED8\">) FROM MyTable WHERE CustomerId <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #F78C6C\">123<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Example 3 &#8211; using multiple filters<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#babed8;--cbp-line-number-width:7.703125px;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"${DeleteRow('MyTable', new [] {new Filter('CustomerId', EQ, 123), new Filter('MyColumn', EQ, 456)})}\" style=\"color:#babed8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg  style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-palenight\" style=\"background-color: #292D3E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #BABED8\">$<\/span><span style=\"color: #89DDFF\">{<\/span><span style=\"color: #82AAFF\">DeleteRow<\/span><span style=\"color: #F07178\">(<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #C3E88D\">MyTable<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #89DDFF\">,<\/span><span style=\"color: #F07178\"> <\/span><span style=\"color: #89DDFF\">new<\/span><span style=\"color: #F07178\"> [] <\/span><span style=\"color: #89DDFF\">{<\/span><span style=\"color: #F07178\">new Filter<\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #C3E88D\">CustomerId<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #89DDFF\">,<\/span><span style=\"color: #F07178\"> <\/span><span style=\"color: #BABED8; font-style: italic\">EQ<\/span><span style=\"color: #89DDFF\">,<\/span><span style=\"color: #F07178\"> 123<\/span><span style=\"color: #89DDFF\">),<\/span><span style=\"color: #F07178\"> new Filter<\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #C3E88D\">MyColumn<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #89DDFF\">,<\/span><span style=\"color: #F07178\"> <\/span><span style=\"color: #BABED8; font-style: italic\">EQ<\/span><span style=\"color: #89DDFF\">,<\/span><span style=\"color: #F07178\"> 456<\/span><span style=\"color: #89DDFF\">)}<\/span><span style=\"color: #F07178\">)<\/span><span style=\"color: #89DDFF\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Equivalent SQL query:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#babed8;--cbp-line-number-width:7.703125px;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"DELETE TOP(1) FROM MyTable WHERE CustomerId = 123 AND MyColumn = 456\" style=\"color:#babed8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg  style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-palenight\" style=\"background-color: #292D3E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #BABED8\">DELETE <\/span><span style=\"color: #82AAFF\">TOP<\/span><span style=\"color: #BABED8\">(<\/span><span style=\"color: #F78C6C\">1<\/span><span style=\"color: #BABED8\">) FROM MyTable WHERE CustomerId <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #F78C6C\">123<\/span><span style=\"color: #BABED8\"> AND MyColumn <\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #F78C6C\">456<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>It is also possible (and in most cases necessary) to match deleted rows with subscriber properties, email etc.<\/p>\n\n\n\n<p>See<a href=\"https:\/\/sites.google.com\/expertsender.com\/dynamic-content-documentation\/data-tables\/getrows\"> GetRows method examples<\/a> for more information.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Example 4 &#8211; real-life scenario, sending emails with single-use coupons<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#babed8;--cbp-line-number-width:7.703125px;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"&lt;!-- get coupon for customer and store in a variable --&gt;\n&lt;var rows=&quot;GetRows('Coupons', 1, null, new [] {new Filter('CustomerId', EQ, SubscriberProperty('customer_id'))})&quot;\/&gt;\n&lt;!-- display coupon code in email --&gt;\n&lt;p&gt;Hello! Here's your coupon: ${rows[0]['CouponCode']}&lt;\/p&gt;\n&lt;!-- delete the coupon so it cannot be used again --&gt;\n${DeleteRow('Coupons', new [] {new Filter('CouponId', EQ, rows[0]['CouponId'])})}\" style=\"color:#babed8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg  style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-palenight\" style=\"background-color: #292D3E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #89DDFF\">&lt;!--<\/span><span style=\"color: #BABED8\"> get coupon for customer and store <\/span><span style=\"color: #89DDFF\">in<\/span><span style=\"color: #BABED8\"> a variable <\/span><span style=\"color: #89DDFF\">--&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #89DDFF\">&lt;<\/span><span style=\"color: #F07178\">var<\/span><span style=\"color: #89DDFF\"> <\/span><span style=\"color: #C792EA\">rows<\/span><span style=\"color: #89DDFF\">=<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #C3E88D\">GetRows(&#39;Coupons&#39;, 1, null, new [] {new Filter(&#39;CustomerId&#39;, EQ, SubscriberProperty(&#39;customer_id&#39;))})<\/span><span style=\"color: #89DDFF\">&quot;<\/span><span style=\"color: #89DDFF\">\/&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #89DDFF\">&lt;!--<\/span><span style=\"color: #BABED8\"> display coupon code <\/span><span style=\"color: #89DDFF\">in<\/span><span style=\"color: #BABED8\"> email <\/span><span style=\"color: #89DDFF\">--&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #89DDFF\">&lt;<\/span><span style=\"color: #F07178\">p<\/span><span style=\"color: #89DDFF\">&gt;<\/span><span style=\"color: #BABED8\">Hello! Here&#39;s your coupon: $<\/span><span style=\"color: #89DDFF\">{<\/span><span style=\"color: #BABED8\">rows[<\/span><span style=\"color: #F78C6C\">0<\/span><span style=\"color: #BABED8\">][<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #C3E88D\">CouponCode<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #BABED8\">]<\/span><span style=\"color: #89DDFF\">}&lt;\/<\/span><span style=\"color: #F07178\">p<\/span><span style=\"color: #89DDFF\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #89DDFF\">&lt;!--<\/span><span style=\"color: #BABED8\"> <\/span><span style=\"color: #89DDFF\">delete<\/span><span style=\"color: #BABED8\"> the coupon so it cannot be used again <\/span><span style=\"color: #89DDFF\">--&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #BABED8\">$<\/span><span style=\"color: #89DDFF\">{<\/span><span style=\"color: #82AAFF\">DeleteRow<\/span><span style=\"color: #F07178\">(<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #C3E88D\">Coupons<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #89DDFF\">,<\/span><span style=\"color: #F07178\"> <\/span><span style=\"color: #89DDFF\">new<\/span><span style=\"color: #F07178\"> [] <\/span><span style=\"color: #89DDFF\">{<\/span><span style=\"color: #F07178\">new Filter<\/span><span style=\"color: #89DDFF\">(<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #C3E88D\">CouponId<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #89DDFF\">,<\/span><span style=\"color: #F07178\"> <\/span><span style=\"color: #BABED8; font-style: italic\">EQ<\/span><span style=\"color: #89DDFF\">,<\/span><span style=\"color: #F07178\"> <\/span><span style=\"color: #BABED8; font-style: italic\">rows<\/span><span style=\"color: #89DDFF\">[<\/span><span style=\"color: #F78C6C\">0<\/span><span style=\"color: #89DDFF\">][<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #C3E88D\">CouponId<\/span><span style=\"color: #89DDFF\">&#39;<\/span><span style=\"color: #89DDFF\">])}<\/span><span style=\"color: #F07178\">)<\/span><span style=\"color: #89DDFF\">}<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"author":6,"featured_media":0,"parent":3874,"menu_order":211,"template":"","format":"standard","emp-category":[],"class_list":["post-3876","es","type-es","status-publish","format-standard","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/help.expertsender.com\/pl\/wp-json\/wp\/v2\/es\/3876","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/help.expertsender.com\/pl\/wp-json\/wp\/v2\/es"}],"about":[{"href":"https:\/\/help.expertsender.com\/pl\/wp-json\/wp\/v2\/types\/es"}],"author":[{"embeddable":true,"href":"https:\/\/help.expertsender.com\/pl\/wp-json\/wp\/v2\/users\/6"}],"version-history":[{"count":3,"href":"https:\/\/help.expertsender.com\/pl\/wp-json\/wp\/v2\/es\/3876\/revisions"}],"predecessor-version":[{"id":14978,"href":"https:\/\/help.expertsender.com\/pl\/wp-json\/wp\/v2\/es\/3876\/revisions\/14978"}],"up":[{"embeddable":true,"href":"https:\/\/help.expertsender.com\/pl\/wp-json\/wp\/v2\/es\/3874"}],"wp:attachment":[{"href":"https:\/\/help.expertsender.com\/pl\/wp-json\/wp\/v2\/media?parent=3876"}],"wp:term":[{"taxonomy":"emp-category","embeddable":true,"href":"https:\/\/help.expertsender.com\/pl\/wp-json\/wp\/v2\/emp-category?post=3876"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}