cancel
If the statement evaluates to true, the triggered email will not send.
cancel( mixed input )
If the cancel statement evaluates to true for that subscriber, and the statement exists in the Setup field of the template, then the email will not send.
Examples
{cancel(!profile.purchase_incomplete)}
If the subscriber does not have an incomplete purchase, then the statement is true and the send will be cancelled.
Cancel Confirmed Opt-In if User Exists on List
Use Case: Cancel a Confirmed Opt-In email if a user already confirmed their list status.Zephyr:
{cancel(contains(profile.lists, "Main List"), "User is on the Main List")}
Result:
Email will not send. If you preview and meet the cancel criteria, you’ll see this message.Explanation:
This script uses contains() to check which list memberships are on an individual user’s profile. If a specific Natural Lists is in that array, the cancel() function will prevent it from sending.
Cancel Send Based On User Var
Use Case:
Cancel a Welcome Email if a user has already received the template. A var indicating the user has received the email can be set using triggers and the api_user() function.Zephyr:
{cancel(profile.vars.welcome_received == true, "User has received the Welcome Email")}
Result:
Email will not send. If you preview and meet the cancel criteria, you’ll see this message:
Explanation: This script uses cancel() to prevent a send from going out by performing an evaluation on the “welcome_received” custom field (var) and checking if the value is “true”.
Cancel Abandoned-Cart Series if Cart Emptied
Use Case: Cancel a follow up abandoned cart email if there’s nothing in the cart.Zephyr:
{cancel(profile.purchase_incomplete == null, "User's cart is empty.")}
Result:
Email will not send. If you preview and meet the cancel criteria, you’ll see this message:
Explanation: This script performs an evaluation of the user’s current incomplete purchases. If it evaluates to null–i.e. there’s nothing currently in the user’s cart–the cancel() function will stop the send. Beneficial for follow-up emails in an Abandoned Cart series.
Cancel if There’s Not Enough Content to Show a User
Use Case: Cancel if there’s not enough content to show a user
{content = filter(content, lambda c: c.vars.sailthru_vertical && c.vars.sailthru_topic ==
profile.vars.favorite_topic)}
{cancel(length(content) < 1, "No content in the user's favorite topic!")}
Explanation: This script is using the filter function to only include any content that has a topic variable that equals a “favorite_topic” variable on the user’s profile. It then checks how many items are left using the length() function. If there’s less than 1 (i.e. no items), then the cancel() function stops the email from going out to that specific user.