If a customer subscribes in our newsletter, they will receive an email with a coupon code.

There is an ampscript in the email template that should return the coupon code using the ClaimRowValue function.

The ‘AccountRegCodeV2' has 250k promo code and the ampscript is written to pull the promo code row by row and at the same time overwrite/populate the other attributes in the DE with details of the subscriber and time it was populated.

However, instead of pulling and populating the promo code, ‘None Available’ is populated instead. This is the default value and should only be returned when there are no more available coupon codes. This error does not always occur. It has happened a few times, but more often than not, the issue does not occur.

Is it possible that this is due to an internal processing of the system (e.g. order of execution) and not the scripting?

Coupon DE: AccountRegCodeV2

Snippet of code:

 %%[var @em, @couponCode, @existingRow, @row, @couponDE 
set @em = AttributeValue("Email") 
set @existingRow = LookupRows("AccountRegCodeV2","EmailAddress",@em) 

if rowcount(@existingRow) > 0 then 
    set @row = Row(@existingRow,1) 
    set @couponCode = field(@row,"CouponCode") 

else if _messagecontext == "PREVIEW" 
    then set @couponCode = "XX ERROR XX" 

else set @couponCode = ClaimRowValue("AccountRegCodeV2", "CouponCode", "IsIssued","None Available","DateIssued",NOW(),"JobID",jobid,"ListID",
    ListID,"BatchID",_JobSubscriberBatchID,"SubscriberKey",_subscriberKey,"SubscriberID", SubscriberID,"EmailAddress",@em,"EmailName",emailname_) 
    endif endif ]

%% %%=v(@couponCode)=%%
  • 1
    You'll need to expand your code snippet to provide more context, or tell us more about what the claim process is. – Tom Callahan Mar 22 at 3:19
  • already updated. kindly view above – sfdclearner Mar 27 at 0:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.