Quantcast
Channel: Active questions tagged ampscript - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 359

Amp script claim row is claiming same row twice

$
0
0

I'm running into a weird case where the claimrow function is claiming the same row for multiple users. What I am trying to do is prevent a user from receiving an email if he/she already received a coupon. In the below code, multiple users are receiving the same code. Anyone has an idea on how to change this?

%%[    var @SubscriberKey, @Email, @defaultCoupon, @claimedbefore, @rows, @rowCount   set @SubscriberKey = attributevalue("SubscriberKey")   set @Email = attributevalue("Email")   set @rows = LookupRows("ent.vouchers","SubscriberKey", @SubscriberKey)set @defaultCoupon = "Er is geen code beschikbaar. Neem contact op met onze klantenservice." set @rowCount = rowcount(@rows)if @rowCount == 0 then    if _messagecontext == "PREVIEW" then         set @couponCode = "XX PREVIEWMAIL XX"     else    set @couponCode = ClaimRowValue("ENT.vouchers", "CouponCode", "IsClaimed", @defaultCoupon, "Email", @Email, "SubscriberKey", @SubscriberKey)endif /*function inserts email into data extention used for exclusion 2 years*/  InsertDE("ent.exclusion_list","Email",    @Email,"SubscriberKey",    @SubscriberKey,"CouponCode",    @couponCode  )elseRaiseError("User already claimed code", True)EndIf]%%’

Viewing all articles
Browse latest Browse all 359

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>