I am trying to create an email that provides the customers an order confirmation email with multiple line items associated with price and qty. I will attach the sample email template how it should look like. I have created a journey builder - Salesforce entry data event with considering two custom objects, which automatically creates a data extension. I am using that data extension to create an email to retrieve the data.

Could you please help me in achieving this with sample AMPscript.

Please find the attached documents of the data we need.

1 2 3

  • What error you getting
    – Ravi.A
    Commented Jun 20, 2018 at 7:19
  • DEColumn1 is not displaying ?
    – Ravi.A
    Commented Jun 20, 2018 at 7:19
  • I am receiving the same email with no data. The email contains with same content with AMPScript.
    – Harry
    Commented Jun 20, 2018 at 7:22
  • close your code begin with %%[ end with ]%% this before DEColumn1 then try
    – Ravi.A
    Commented Jun 20, 2018 at 7:29
  • One more question, there is no data in the data extension for Site_Order_Detail__r:Extended_Price__C. How should I solve that issue
    – Harry
    Commented Jun 20, 2018 at 7:34

2 Answers 2


I'd recommend reviewing the LookupOrderedRows() example on this page and modifying it for your DE and fields.

You'll need to determine what field from your journey's entry data extension is the connection to the order confirmation data. That key value is what you need to use for @lookupValue.

The first parameter of the LookupOrderedRows function should be the data extension that contains the order data.

Inside the for-loop, you can update the variables to match the column names in your order data extension.

var @rows, @row, @rowCount, @numRowsToReturn, @lookupValue, @i

set @lookupValue = AttributeValue("Region") /* value from attribute or DE column in send context */
set @numRowsToReturn = 0 /* 0 means all, max 2000 */
set @rows = LookupOrderedRows("LoyaltyMembers", @numRowsToReturn, "rank desc, firstName asc", "region", @lookupValue)
set @rowCount = rowcount(@rows)

output(concat("region: ", @lookupValue))

if @rowCount > 0 then

  for @i = 1 to @rowCount do

    var @firstName, @emailAddress, @rank
    set @row = row(@rows, @i) /* get row based on counter */
    set @rank = field(@row,"rank")
    set @firstName = field(@row,"firstName")
    set @emailAddress = field(@row,"emailAddress")


    <br>Row %%=v(@i)=%%, rank: %%=v(@rank)=%%, firstName: %%=v(@firstName)=%%, emailAddress: %%=v(@emailAddress)=%%


  next @i ]%%

%%[ else ]%%

No rows found

%%[ endif ]%%

use like that

           your amp script code here
        DEColumn1 is %%=v(@DEColumn1)=%%

You must log in to answer this question.

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