We have an email in prod that is for some reason not displaying some users their coupon code. In testing, I receive a code across multiple email clients. Email Ampscript is
%%[
SET @Salesforce_Id = _subscriberkey
SET @dateassigned = NOW()
SET @couponrow_check = LookupOrderedRows('CouponbankDE',1,'Assigned_Date Desc','Salesforce_Id',@Salesforce_Id)
IF RowCount(@couponrow_check) > 0 THEN
SET @Salesforce_Id_Check = Lookup('CouponbankDE','Salesforce_Id','CouponCode',Field(Row(@couponrow_check, 1) , 'CouponCode'))
ENDIF
IF _messagecontext != "VAWP" AND _messagecontext != "PREVIEW" AND @Salesforce_Id_Check != @Salesforce_Id THEN
SET @CouponRow = ClaimRow('CouponbankDE', 'IsClaimed', 'Salesforce_Id', @Salesforce_Id, 'Assigned_Date', @dateassigned)
IF NOT EMPTY(@CouponRow) THEN
SET @CouponCode = Field(@CouponRow, 'CouponCode')
ENDIF
ELSE
SET @couponrow1 = LookupOrderedRows('CouponbankDE',1,'Assigned_Date Desc','Salesforce_Id',@Salesforce_Id)
IF RowCount(@couponrow1) > 0 THEN
SET @CouponCode = Field(Row(@couponrow1, 1) , 'CouponCode')
ENDIF
ENDIF
IF _messagecontext == "VAWP" THEN
SET @couponrow1 = LookupOrderedRows('CouponbankDE',1,'Assigned_Date Desc','Salesforce_Id', @Salesforce_Id)
IF RowCount(@couponrow1) > 0 THEN
SET @CouponCode = Field(Row(@couponrow1, 1) , 'CouponCode')
ENDIF
ENDIF
]%%
]%%
CouponbankDE
-- including field names, data types, primary key fields, etc.