0

I have this table (Product_Recommendations) of recommended products (4) per email address.

enter image description here

I want to add these products into my email, using ampscript lookup. I tried the following, but it was erroring out in Marketing Cloud:

%%[

VAR @emailAddr, @p1_name, @p1_url, @p1_image 
set @emailAddr = EmailAddress("emailaddr") 
SET @p1_name = (Lookup("Product_Recommendation", "Product_Name_1" EmailAddress",@emailaddr)) 
SET @p1_url = (Lookup("Product_Recommendation", "Product_URL_1" EmailAddress",@emailaddr)) 
SET @p1_image = (Lookup("Product_Recommendation", "Product_Image_1" EmailAddress",@emailaddr))

]%%

Not sure what I am doing wrong. Thanks!

  • 1
    As @TravisNaughton mentioned in his answer, your @emailAddr var is only going to return true or false as the EmailAddress() function returns a booleen response depending on if the content inside is a valid email or not. This is likely your major issue. – Gortonington Oct 2 '18 at 13:00
2

To access the email address attribute you want to use Attribute Value function. Also the syntax on the lookups doesn't need the extra brackets.

%[VAR @emailAddr, @p1_name, @p1_url, @p1_image 
SET @emailaddr = AttributeValue("emailaddr") 
SET @p1_name = Lookup("Product_Recommendation", "Product_Name_1" EmailAddress",@emailaddr)
SET @p1_url = Lookup("Product_Recommendation", "Product_URL_1" EmailAddress",@emailaddr) 
SET @p1_image = Lookup("Product_Recommendation", "Product_Image_1" EmailAddress",@emailaddr)]%%
| improve this answer | |

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.