Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wvpv/dabf8354075275b85b03 to your computer and use it in GitHub Desktop.
Save wvpv/dabf8354075275b85b03 to your computer and use it in GitHub Desktop.
SFMC AMPScript Flexible Content Areas with XML Interfaces 1
%%[
set @products = LookupOrderedRows("ProductDE",6, "AvgCustomerRating desc" ,"ApprovedForEmail","true")
set @productCount = rowcount(@products)
set @productXML = "<products>"
for @i = 1 to @productCount do
set @product = Row(@products, @i)
set @productImageURL = Field(@product, "ProductImageURL")
set @productXML = concat(@productXML,"<product>")
set @productXML = concat(@productXML,"<productImageURL><![CDATA[",@productImageURL,"]]></productImageURL>")
set @productXML = concat(@productXML,"</product>")
next @i
set @productXML = concat(@productXML,"</products>")
]%%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment