I'm building a Trigger Campaign that relates to a customer's purchase.

The purchase data is located on a Data Extension table. This Data Extension table has Subscriber Key and Purchase IDs. There is another Data Extension table that maps out the Purchase IDs with the Marketing Product Name (i.e., what the end-user needs to get in the email.

My question is twofold:

  1. Is it even possible to pull in Data Extension values on a Trigger Campaign that is being sent to a subscriber record? If so,

  2. How can I string the data from the Data Extension table with the Purchase IDs to the Data Extension table with Marketing Product Names so that the customer will receive something like:

"Thanks for buying green gadgets" instead of "Thanks for buying PID-1"

I would like to note that a customer could buy more than one item.

Thank you in advance for your help.

1 Answer 1


Sure it's possible. You can retrieve external data in an email in a Triggered Send Definition. You'd need to utilize one of the AMPScript lookup functions. Something like this:

var @rows, @row, @rowCount
var @purchaseID, @subscriberKey
set @purchaseID = AttributeValue("purchaseID")
set @subscriberKey = AttributeValue("_subscriberkey")

set @rows = LookupRows("PurchaseData","purchaseID", @purchaseID, "SubscriberKey", @subscriberKey)
set @rowCount = rowcount(@rows)

if @rowCount > 0 then

    var @productID, @DEColumn2
    set @row = row(@rows,1) /* get row #1 */
    set @productID = field(@row,"productID")

    var @marketingProductName

    /* another lookup to retrieve the Marketing ProductName goes here */


marketingProductName for %%=v(@purchaseID)=%% and %%=v(@productID)=%% is %%=v(@marketingProductName)=%%

%%[ else ]%%

No purchase data found

%%[ endif ]%%

I have samples of each of common lookup scenarios on my blog.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .