Last active
June 4, 2019 16:31
-
-
Save wvpv/04d4e1a7274e03f25d1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%[ | |
var @em, @couponRow, @couponCode | |
if _messagecontext == "PREVIEW" then | |
set @couponCode = "XX TEST XX" | |
else | |
/* include your sendable attribute/column here */ | |
set @em = AttributeValue("emailAddr") | |
set @couponRow = ClaimRow("CouponsCodes", "IsClaimed", "EmailAddress", @em) | |
if empty(@couponRow) then | |
/* You can do other error handling here if you want.*/ | |
/* This aborts the send */ | |
RaiseError("No coupons available", false) | |
else | |
SET @couponCode = Field(@couponRow, "CouponCode") | |
endif | |
endif | |
]%% | |
Here's your coupon code: %%=v(@couponCode)=%% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I suppose you could pass the code into a tweet link:
Details here.