We have an email that we are populating with certain coupons that customers qualify for. Customers can qualify for up to 3 coupons that are tied to SUI codes, but only one coupon can be displayed at one time. As customers redeem coupons that SUI code is removed from the data ext. and the current Ampscript only recognizes the first SUI code (SUI1
), so if it's null nothing is displayed.
What I want to do is replace SUI1
, if null, with another SUI, SUI2
or SUI3
, but the current Ampscript I'm using isn't working. Has anyone done anything like this and gotten it to work? Any tips on my code to get it working? Thx.
%%[
var @Tracking_ID_1, @Tracking_ID_2, @Tracking_ID_3, @Lookup1, @Lookup2, @Promo_Code, @Lookup3, @Lookup4, @Lookup5, @Lookup6
set @Tracking_ID_1 = [Reward_marketing_tracking_id_1]
set @Tracking_ID_2 = [Reward_marketing_tracking_id_2]
set @Tracking_ID_3 = [Reward_marketing_tracking_id_3]
set @Lookup1 = @Reward_marketing_tracking_id_1
Set @Lookup2 = @Reward_Promo_Code_1
set @Lookup3 = @Reward_marketing_tracking_id_2
Set @Lookup4 = @Reward_Promo_Code_2
set @Lookup5 = @Reward_marketing_tracking_id_3
Set @Lookup6 = @Reward_Promo_Code_3
Set @Delivery = Lookup("Certificate and Coupons FINAL", "Delivery_Method", "Marketing_Tracking_ID", @Lookup1, "Promo_Code", @Lookup2)
]%%
%%[
IF isNull(@Lookup1) then
set [@Tracking_ID_1] = [reward_marketing_tracking_id_2]
ELSEIF isNull(@Lookup3) then
set [@Tracking_ID_1] = [reward_marketing_tracking_id_3]
ENDIF
]%%
%%[ IF @Delivery == 'Email' then Set @SUIText = 'Enjoy this email exclusive offer'
ELSEIF @Delivery == 'Postal' then set @SUIText = 'Here''s a copy of the offer you received in the mail' ENDIF
IF @Delivery == 'Email' then set @SUIDisclaimer = 'email and online.'
ELSEIF @Delivery == 'Postal' then set @SUIDisclaimer = 'mail, email and online.' ENDIF
%%[endif]%%
%%[IF NOT Empty (@Alpha_trigger_1) THEN]%%