0

I want to give out more than one code in an email based on a number field in a DE.

Currently, I'm using a for loop that goes from 1 to that number field, I have the claimrow within the loop, but for it shows me the same coupon code multiple times in the same email. The for loop runs successfully.

Here is what I use for testing now.

%%[ 

for @i = 1 to @nr_of_combos DO

    VAR @CouponRow
    SET @CouponRow = ClaimRow('Coupons_active', IsClaimed','Salesforce_Subscriber_Key',Salesforce_Subscriber_Key)

    IF EMPTY(@CouponRow) THEN 
    ]%%

    <p>No coupons available… please contact us … </p>

    %%[ ELSE ]%% 

        %%=FIELD(@CouponRow,'CouponCode')=%% 

    %%[ ENDIF ]%%

%%[ 

NEXT @i 

]%%
1

Ok so I figured it out. I have created a new field in the DE that represents the NR of coupon code allocated to a person. So if you have 2 or more codes in an email, all entries will be unique. I just named it 'i' for my test.

SET @CouponRow = ClaimRow('Coupons_active', 'IsClaimed','Salesforce_Subscriber_Key',Salesforce_Subscriber_Key,'EmailAddress',Emailaddress, 'i', @i)

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.