I am using regularly the ClaimRow() function in many of my sends for assigning coupons to my subscribers. As I have to be able to assign more than one coupon to my subscribers from different sends, I have included some extended functionality to the ClaimRow function: basically after claiming one coupon, I delete the coupon from the original data extension and insert the claimed details in a secondary data extension for keep monitoring the coupons being claimed properly. As I am deleting the records from the original data extension I can use ClaimRow later on and assign new coupons to the same subscriber. This functionality is working properly.
Now, I have to assign in one unique email, two different coupons to the same subscriber, so what I am doing is to execute my code twice in a row. The thing is that is not working. It is assigning properly the first coupon, so the first time I call ClaimRow() function is working but after that gets blocked and the Email is being cancelled.
My code is:
Set @CouponRow = ClaimRow('DEName', 'IsClaimed', 'SubscriberKey', _subscriberkey, 'EmailAddress', emailaddr)
IF NOT EMPTY(@CouponRow) THEN
Set @couponCode = Field(@CouponRow, "CouponCode")
Set @ClaimedDate = Lookup('DEName','ClaimedDate','CouponCode', @couponCode)
Set @TimeStamp = Lookup('DEName','TimeStamp','CouponCode', @couponCode)
InsertDE('DEName_Claimed','CouponCode', @couponCode, 'EmailAddress', emailaddr, 'isClaimed','True', 'TimeStamp', @TimeStamp, 'ClaimedDate', @ClaimedDate, 'SubscriberKey', _subscriberkey)
DeleteDE('DEName','CouponCode', @couponCode)