This function enables the suppression or cancellation of an email send. It is useful for exception handling in your code, if an unexpected result occurs.
|1||String||True||Error message to display or log (see note)|
|2||Boolean||False||Indicates whether the function skips the send for current Subscriber and continues or stops. A value of
|3||String||False||User defined API error code (see note)|
|4||Number||False||User defined API error number (see note)|
|5||Boolean||False||Indicates whether the function preserves Data Extension rows inserted, updated, or deleted by AMPscript functions before error occurs, even if the process skips the Subscriber. A value of
NOTE: Arguments 1, 3 and 4 output by the function are not available from Send Tracking in Email Studio. Marketing Cloud Support will be able to advise of the function output.
NOTE: This function still counts as an email send, even if an email was not sent to a Subscriber. Only use this function for exception handling, not for segmenting or excluding a large number of Subscribers.
The following example uses the ClaimRow function to allocate a coupon code value from a Data Extension to a Subscriber, if a coupon is available and not already assigned to the Subscriber’s email address. If the coupon has previously been assigned to the Subscriber, then the previously allocated coupon code is returned.
%%[ var @email, @couponRow, @couponCode /* include the send context attributes or columns to record here */ set @email = AttributeValue("emailAddr") set @couponRow = ClaimRow("CouponCodes", "IsClaimed", "EmailAddress", @email) if not empty(@couponRow) then set @couponCode = Field(@couponRow, "CouponCode") else RaiseError("No coupons available") endif ]%% Coupon code: %%=v(@couponCode)=%%
If no coupon codes are available, the following message appears when previewing an email and the email send is aborted.
No coupons available