0

i have a question right now i am using the claimRow() for sending the coupon codes to the customers(email) through journey builder. Now the problem is no matter how many times they have been added to the journey they are getting the same coupon code now i want to send them a unique different for every entry.Hope someone will help me out

var @em, @couponRow, @couponCode
set @em = AttributeValue("emailAddr")
set @couponRow = ClaimRow("CouponCodes","IsClaimed","EmailAddress",@em)
if not empty(@couponRow) then 
set @couponCode = Field(@couponRow, "CouponCode")
endif
]%%```
0

1 Answer 1

2

You need to understand how Claimrow function selects and claims rows. The lookup is based on the last pairs of variables you provide in the function call. If a row already exists with this data, it will be selected. Otherwise a new row will be claimed.

In your example, you are only sending the email address:

ClaimRow('CouponCodes','IsClaimed','EmailAddress',@em)

As each time an email is sent to a given recipient, you will find the same row and re-send the same voucher code. You will need more parameters in your function call to ensure unique code will be sent to the same individual in each email, like this:

ClaimRow('CouponCodes', 'IsClaimed', 'JobID', JobID, 'ListID', ListID, 'BatchID', _JobSubscriberBatchID, 'EmailAddress', @em)
4
  • could you please help me out how to collect those job and list id's it would really helpful i am new to ampscript Nov 9, 2021 at 11:25
  • Please read up on the documentation and examples out there. Here are few to begin with: ampscript.xyz ampscript.com sprignaturemoves.com Nov 9, 2021 at 11:30
  • Also, the jobID, ListID, etc, are all personalisation strings, so they are automatically populated for you. For the complete list of personalisation strings, please check out this page. Nov 9, 2021 at 11:40
  • Thank you @Lukas i have tried your approach and it worked Thank you Nov 10, 2021 at 6:26

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.