I have an email in a journey that is using the ClaimRow AMPscript function to send unique vouchers.
The ClaimRow function is included into an "If Statement", and repeated multiple times, so that we can claim vouchers from different data extensions depending on a condition. The code looks like this:
IF @VoucherType == 'A' THEN
SET @CouponCodeRow = ClaimRow('DataExtension_A','IsClaimed','ClaimedBy',@SubscriberKey)
SET @CouponCode = field(@CouponCodeRow,'CouponCode')
UpdateDE('DataExtension_A',1,'CouponCode',@CouponCode,'ClaimedBy',@ClaimedBy)
ELSEIF @VoucherType == 'B' THEN
SET @CouponCodeRow = ClaimRow('DataExtension_B,'IsClaimed','ClaimedBy',@SubscriberKey)
SET @CouponCode = field(@CouponCodeRow,'CouponCode')
UpdateDE('DataExtension_B',1,'CouponCode',@CouponCode,'ClaimedBy',@ClaimedBy)
ELSEIF @VoucherType == 'C' THEN
SET @CouponCodeRow = ClaimRow('DataExtension_C','IsClaimed','ClaimedBy',@SubscriberKey)
SET @CouponCode = field(@CouponCodeRow,'CouponCode')
UpdateDE('DataExtension_C',1,'CouponCode',@CouponCode,'ClaimedBy',@ClaimedBy)
ELSE
RaiseError ('xxx', true)
ENDIF
The code works as expected and claims the voucher from the proper DE, however, it ALSO claims a voucher from the last data extension included in the IF statement (in my example it would be "DataExtension_C"), so 2 rows are claimed every time an email is sent.
Following my example, when the VoucherType is 'A', a row is claimed from the "DataExtension_A" and the voucher is shown in the email, but another row is claimed from "DataExtension_C". A voucher from "DataExtension_C" is always claimed, no matter what the conditions.
The voucher from the "DataExtension_C" is not sent to the subscriber, but it appears as 'claimed' in the data extension, so we're consuming a significant amount of vouchers.
No idea what's going on here! Has anyone seen this before?