[SalesForce] Amscript error in marketing cloud salesforce

Can anyone help in salesforce marketing cloud AMscript error.

A profile center link is missing from this email. For template based
email, please contact our customer service. Personalization error: The
personalization string "" was not found in the following data
extension(s). To fix the problem, please try the following:
– Make sure that there is not a space or typo within the personalization string in your email. For example, check and correct
any spaces between percent signs (%%)
– Verify that the field containing the personalization string value is in all data extensions used.
– Correct the HTML Body of your email. Personalization error: The personalization string "" was not found in the following data
extension(s). To fix the problem, please try the following:
– Make sure that there is not a space or typo within the personalization string in your email. For example, check and correct
any spaces between percent signs (%%)
– Verify that the field containing the personalization string value is in all data extensions used.
– Correct the HTML Body of your email. There is an error in your email. Please contact your customer service representative. Error 1:
Script SET Statement Invalid
An error occurred when attempting to
resolve a script expression. See inner exception for detail. Script
Expression: LookupRows("B2C_OrderHeader_EMEA_TEST", "OrderId",
OrderNumber) MemberID: 10981467 JobID: 0 The specified attribute
or custom object field name was not found for this client. Function
Call: LookupRows("B2C_OrderHeader_EMEA_TEST", "OrderId", OrderNumber)
Attribute or Field Name: OrderNumber
Invalid Content:
SET
@order = LookupRows("B2C_OrderHeader_EMEA_TEST", "OrderId",
OrderNumber) There is an error in your email. Please contact your
customer service representative. Error 2: Script SET Statement
Invalid
An error occurred when attempting to resolve a script
expression. See inner exception for detail. Script Expression:
LookupRows("B2C_OrderDetails_EMEA_TEST", "OrderId", OrderNumber)
MemberID: 10981467 JobID: 0 The specified attribute or custom
object field name was not found for this client. Function Call:
LookupRows("B2C_OrderDetails_EMEA_TEST", "OrderId", OrderNumber)
Attribute or Field Name: OrderNumber
Invalid Content:
SET
@orderLine = LookupRows("B2C_OrderDetails_EMEA_TEST", "OrderId",
OrderNumber) There is an error in your email. Please contact your
customer service representative. Error 3: Script SET Statement
Invalid
An error occurred when attempting to resolve a script
expression. See inner exception for detail. Script Expression:
LookupRows("B2C_OrderPayments_EMEA_TEST", "OrderId", OrderNumber)
MemberID: 10981467 JobID: 0 The specified attribute or custom
object field name was not found for this client. Function Call:
LookupRows("B2C_OrderPayments_EMEA_TEST", "OrderId", OrderNumber)
Attribute or Field Name: OrderNumber
Invalid Content:
SET
@payment = LookupRows("B2C_OrderPayments_EMEA_TEST", "OrderId",
OrderNumber)[![enter image description here][1]][1]


Below is the script I have.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
<html>



%%[ /* Retreive Order Header from the OrderHeader Data Extension */ 
var @orderRow , @order, @orderTotal, @orderCounter, @orderLineRow, @orderLine,@cnt, @style, @shippingMethod, @orderLineCounter, @cnt1, @payment, @paymentCounter, @PaymentRow, @paymentRowLine,@paymentLogo, @lineSubtotal, @full_ship_name, @address_ship, @full_bill_name, @address_bill, @imageLink , @original_style
SET @order = LookupRows("B2C_OrderHeader_EMEA_TEST", "OrderId", OrderNumber) 
Set @orderCounter = rowCount(@order)

if @orderCounter != 0 then 
SET @orderRow = ROW(@order,1) 
SET @orderLine = LookupRows("B2C_OrderDetails_EMEA_TEST", "OrderId", OrderNumber)
SET @orderLineCounter = rowCount(@orderLine) 

if @orderLineCounter != 0 then 
 SET @orderLineRow = Row(@orderLine, 1)
    Set @OrderTotal = 0 
 if not empty( FIELD(@orderRow, "ProductSubtotal")) then
    Set @OrderTotal =  FIELD(@orderRow, "ProductSubtotal")
 Endif
 if not empty( FIELD(@orderRow, "ShippingAmount")) then
     Set @OrderTotal =  add(@orderTotal, FIELD(@orderRow, "ShippingAmount"))
 Endif 

 if not empty( FIELD(@orderRow, "TaxAmount")) then
     Set @OrderTotal =  add(@orderTotal, FIELD(@orderRow, "TaxAmount"))
 Endif  


if not empty(FIELD(@orderRow, "DiscountAmount")) then 
  set @orderTotal = add(@orderTotal, FIELD(@orderRow, "DiscountAmount")) 
endif 

set @full_ship_name=Concat(Concat(ProperCase(FIELD(@OrderRow, "Ship_FirstName")),' '), ProperCase(FIELD(@OrderRow, "Ship_LastName")))    
If not empty(FIELD(@orderRow, "Ship_Address2")) then 
  set @address_ship = concat(concat(FIELD(@orderRow, "Ship_Address1"), ''), FIELD(@orderRow, "Ship_Address2") ) 
else
   set @address_ship = FIELD(@orderRow, "Ship_Address1") 
Endif 

/* Billing address Names */
set @full_bill_name=Concat(Concat(ProperCase(FIELD(@OrderRow, "Bill_FirstName")),' '), ProperCase(FIELD(@OrderRow, "Bill_LastName")))  

If not empty(FIELD(@orderRow, "Bill_Address2")) then 
set @address_bill = concat(concat(FIELD(@orderRow, "Bill_Address1"), ''), FIELD(@orderRow, "Bill_Address2") ) 
Else 
set @address_bill = FIELD(@orderRow, "Bill_Address1") 
Endif 

/* Payment Fields */
SET @payment = LookupRows("B2C_OrderPayments_EMEA_TEST", "OrderId", OrderNumber) Set @paymentCounter = rowCount(@payment) 

/* Billing Country */
SET @billing_country = FIELD(@OrderRow, "Bill_Country")

endif endif]%%


<table class="width320" width="600" align="center" border="0" cellspacing="0" cellpadding="0">
 %%[if @orderCounter > 0 then do ]%%
 <tr>
  <td align="left">
      <table class="width320" width="600" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
    <tr>
     <td align="right" valign="top" bgcolor="#ffffff">
      <table cellpadding="0" cellspacing="0" border="0" width="100%">
       <tr>
        <td valign="middle" align="left" style="font-family:Arial, sans-serif; font-size:11px; color:#333333; padding:5px 0px 10px 20px;"><a href="%%view_email_url%%" alias="View as a web page" target="_blank" style="text-decoration: underline; color:#6d6147;">View as a web page</a></td>
       </tr>
      </table>
     </td>
    </tr>

                <!--LOGO AND PREHEADER-->
                        <!--LOGO-->
                        <!--END OF LOGO-->
                        <!--PREHEADER TEXT-->
                        <!--END OF PREHEADER TEXT-->
                <!--LOGO AND PREHEADER-->

                <!-- DESKTOP AND MOBILE HEADER -->
                <tr>
                    <td style="padding: 0px; line-height: 0px; font-size: 0px; width: 0px; height: 0px;" align="left" border="0" cellspacing="0" cellpadding="0">
                        <!--DESKTOP HEADER-->
                        <table class="mobileHide" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td class="mobileHide" width="600" height="44" style="line-height:44px;">
                                    <div class="mobileHide">
                                        <a href="http://www.carhartt.com?cid=email_trigger-confirmational" target="_blank"></a>
                                    </div>
                                </td>
                            </tr>
                        </table>
                        <!--END OF DESKTOP HEADER-->
                        <!--MOBILE HEADER-->
                        <table class="mobileShow" border="0" cellspacing="0" cellpadding="0" style="display:none; line-height: 0px; font-size: 0px; width: 0px; height: 0px;">
                            <tr>
                                <td class="mobileShow" style="display:none; line-height: 0px; font-size: 0px; width: 0px; height: 0px;">
                                    <a href="http://www.carhartt.com?cid=email_trigger-confirmational" target="_blank"><img class="mobileShow" src="http://s7d9.scene7.com/is/image/Carhartt/headerconfirmationemail_320" alt="" border="0" style="display:none; line-height: 0px; font-size: 0px; width: 0px; height: 0px;"/></a>
                                </td>
                            </tr>
                        </table>
                        <!--END OF MOBILE HEADER-->
                    </td>
                </tr>
                <!-- END OF DESKTOP AND MOBILE HEADER -->

                <!--ORDER DETAILS-->
                <tr>
                    <td align="right" style="padding:5px 10px 10px 0px; font-family: Arial, Helvetica, sans-serif; font-size:12px; line-height:25px; color:#333333; text-align:right; font-weight:bold;">
                        <a href="https://www.carhartt.com/LogonForm?catalogId=10551&myAcctMain=1&langId=-1&storeId=10201" alias="My Account" target="_blank" style="text-decoration: none; color:#333333;">MY ACCOUNT</a>&nbsp; <span style="color:#999999;">|</span> &nbsp;<a href="https://www.carhartt.com/LogonForm?catalogId=10551&myAcctMain=1&langId=-1&storeId=10201&URL=OrderHistoryView" alias="Order History" target="_blank" style="text-decoration: none; color:#333333;">ORDER HISTORY</a>
                    </td>
                </tr>
    <tr>
                    <td align="center" style="padding:25px 0px 15px 0px; font-family: Arial, Helvetica, sans-serif; font-size:19px; line-height:25px; color:#6d6147; text-align:center;">
                        ORDER CONFIRMATION
                    </td>
    </tr>
                <tr>
                    <td style="padding:0px; line-height:0px; font-size:0px; width:0px; height:0px;" align="left" border="0" cellspacing="0" cellpadding="0">
                        <table border="0" cellspacing="0" cellpadding="0">
       <tr>
        <td>
                                    <table class="width320" style="font-family:Arial, Helvetica, sans-serif; color:#6d6147;" width="600" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td align="center" style="padding-top:5px; font-family: Arial, Helvetica, sans-serif; font-size:16px; line-height:22px; color:#6d6147; text-align:center;">
            ORDER #%%OrderNumber%%
           </td>
          </tr>
           <td align="center" style="font-family: Arial, Helvetica, sans-serif; font-size:16px; line-height:22px; color:#6d6147; text-align:center;">
            TOTAL: %%=FORMAT(@orderTotal, "C2")=%%
           </td>
          </tr>
          <tr>
           <td align="center" style="padding-bottom:25px; font-family: Arial, Helvetica, sans-serif; font-size:16px; line-height:22px; color:#6d6147; text-align:center;">
            PLACED ON: %%=FIELD(@orderRow, "OrderDate")=%%
           </td>
          </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
     </td>
    </tr>
    <tr>
                    <td style="padding:0px; line-height:0px; font-size:0px; width:0px; height:0px;" align="center" border="0" cellspacing="0" cellpadding="0">
                        <table border="0" cellspacing="0" cellpadding="0">
       <tr>
        <td>
                                    <table class="width320" style="font-family:Arial, Helvetica, sans-serif; color:#6d6147;" width="580" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td align="center" style="padding: 0px 15px 20px 15px; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 18px; color: #6d6147; text-align:left; font-weight:normal;">
                                                Thank you for ordering from Carhartt.com. This email confirms that we have received your order. You will not be charged for any items until your order ships. We will send you a shipping confirmation email with your tracking number as soon as your order ships.<br /><br />
                                                Please note, your order may arrive in multiple shipments. However, no additional shipping charges will be applied. To check the status of your order at any time, please click <a href="http://www.carhartt.com/OrderHistoryView?catalogId=10551&langId=-1&storeId=10201" alias="Order History" target="_blank" style="text-decoration:underline; color:#6d6147;">here</a>.<br /><br />
                                                If you have any questions or comments, do not hesitate to call our Customer Service Department at 800 833-3118 or email us at <a style="color:#6d6147; font-weight:normal; text-decoration:none;" href="mailto:just_ask_us@carhartt.com">just_ask_us@carhartt.com</a>.
                                            </td>
          </tr>
                                    </table>
        </td>
       </tr>
      </table>
     </td>
    </tr>
                <!--END OF ORDER DETAILS-->

                <tr>
                 <td align="center">
               <table class="width320" align="center" style="font-family:Arial, Helvetica, sans-serif; color:#6d6147;" width="600" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td align="center" style="background: #ffffff; padding:15px 0px 0px 0px;">
                                    <table class="width320" align="left" style="font-family:Arial, Helvetica, sans-serif; color:#6d6147;" width="380" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
           <td style="border-top:1px solid #6d6147; padding-bottom:30px;" valign="top">
                                            <!-- PRODUCT DETAILS --- DUPLICATE FOR EACH PRODUCT WITHIN ORDER -->

            %%[ FOR @cnt = 1 to @orderLineCounter do 
             Set @orderLineRow = Row(@orderLine, @cnt) 

             Set @original_Style = FIELD(@orderLineRow, "Style")
             If IndexOf(@original_style,'OUT_')> 0 then
             Set @original_style = substring(@original_style, 5, Length( Trim(@Original_Style) ) ) 
             Endif

             Set @imageLink = concat(concat(concat("http://s7d9.scene7.com/is/image/Carhartt/", trim(@original_style)), trim(FIELD(@orderLineRow, "ColorCode"))), "?$70x70$") ]%% 
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                 <tr>
                                                        <td style="padding-top:20px; font-size:12px; font-family:Arial, Helvetica, sans-serif; color:#6d6147; line-height:16px;">
               <table align="left" width="210" border="0" cellspacing="0" cellpadding="0" style="font-family:Arial, Helvetica, sans-serif; font-weight:normal;">
                <tr>
                 <td width="120" valign="top"><img src="%%=trim(@imageLink)=%%" width="88" height="90" border="0" style="display:block;"></td>
                 <td width="118" align="left" valign="top">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0" style="font-family:Arial, Helvetica, sans-serif;">
                   <tr>
                    <td style="color:#6d6147; font-size:11px;">
                     STYLE NO. %%=FIELD(@orderLineRow, "Style")=%%
                                                                                </td>
                   </tr>
                   <tr>
                    <td style="font-size:12px;">
                                                                                 <a href="%%=redirectTo(concat(trim(FIELD(@orderLineRow, 'ProductURL')), '&cm_mmc=Email-_-orderconf-_-body-_-detail'))=%%" alias="anAlias">%%=FIELD(@orderLineRow, "ProductName")=%%</a>
                    </td>
                   </tr>
                   <tr>
                    <td style="color:#6d6147; font-size:11px;">COLOR: <img src="http://s7d9.scene7.com/is/image/Carhartt/%%=FIELD(@orderLineRow, 'Swatch')=%%_SW?$pdp-swatch-retina$" width="13" height="13" border="0">
                                                                                 %%=FIELD(@orderLineRow, "ColorDescription")=%%
                    </td>
                   </tr>
                   <tr>
                    <td style="color:#6d6147; font-size:11px;">
                                                                                 SIZE: %%=FIELD(@orderLineRow, "Size")=%%
                    </td>
                   </tr>
                  </table>
                 </td>
                </tr>
               </table>
               <table align="right" width="110" border="0" cellspacing="0" cellpadding="0" style="font-family:Arial, Helvetica, sans-serif;">
                                                                <tr>
                                                                    <td>
                                                                        <table width="100%" border="0" cellspacing="0" cellpadding="0" style="font-family:Arial, Helvetica, sans-serif;">
                                                                            <tr>
                                                                                <td style="padding-right:10px; font-size:12px; font-weight:normal; font-family: Arial, Helvetica, sans-serif; line-height:16px; color:#6d6147;" valign="top" width="100%" align="right">
                                                                                    UNIT PRICE:<br />
                     %%=FORMAT(FIELD(@orderLineRow, "Price"), "C2")=%%
                                                                                </td>
                   </tr>
                                                                            <tr>
                                                                             <td style="padding-right:10px; font-size:12px; font-weight:normal; font-family: Arial, Helvetica, sans-serif; line-height:16px; color:#6d6147;" valign="top" width="100%" align="right">&nbsp;
                    </td>
                   </tr>
                                                                            <tr>
                                                                                <td style="padding-right:10px; font-size:12px; font-weight:normal; font-family: Arial, Helvetica, sans-serif; line-height:16px; color:#6d6147;" valign="top" width="100%" align="right">
                                                                                    QUANTITY:<br />
                     %%=FIELD(@orderLineRow, "Quantity")=%%
                                                                                </td>
                   </tr>
                                                                            <tr>
                                                                             <td style="padding-right:10px; font-size:12px; font-weight:normal; font-family: Arial, Helvetica, sans-serif; line-height:16px; color:#6d6147;" valign="top" width="100%" align="right">&nbsp;
                    </td>
                   </tr>
                                                                            <tr>
                                                                             <td style="padding-right:10px; font-size:12px; font-weight:normal; font-family: Arial, Helvetica, sans-serif; line-height:16px; color:#6d6147;" valign="top" width="100%" align="right">
                                                                                    SALE PRICE:<br />
                     %%[ if not empty(FIELD(@orderLineRow, "ProductDiscount")) then

                                                                                     set @lineQuantity = FIELD(@orderLineRow, "Quantity")
                                                                                        set @originalPrice = FIELD(@orderLineRow, "Price")
                                                                                        set @originalPriceTotal = MULTIPLY(@originalPrice, @lineQuantity) ]%%

                                                                                        <span style="color:#ff0004; text-decoration: line-through">%%=FORMAT(@originalPriceTotal, "C2")=%%</span><br />
                                                                                    %%[endif]%% 

                                                                                    %%[ if not empty(FIELD(@orderLineRow, "ProductSubtotal")) then 
                                                                                        set @lineSubtotal = FIELD(@orderLineRow, "ProductSubtotal") 

                                                                                        set @lineQuantity = FIELD(@orderLineRow, "Quantity")

                                                                                            if not empty(FIELD(@orderLineRow, "ProductDiscount")) then

                                                                                            set @productDiscount = FIELD(@orderLineRow, "ProductDiscount")
                                                                                            set @productDiscountTotal = MULTIPLY(@productDiscount, @lineQuantity)
                                                                                         set @productSubtotal = FIELD(@orderLineRow, "ProductSubtotal")
                                                                                            set @lineSubtotal = add(@productSubtotal, @productDiscountTotal)

                                                                                      Endif]%%    

                                                                                    %%=FORMATCURRENCY(@lineSubtotal,"en-US")=%%

                                                                                    %%[endif]%%
                                                                                </td>
                   </tr>
                  </table>
                 </td>
                </tr>
               </table>
              </td>
             </tr>
             <tr>
              <td style="border-bottom:dotted 2px #6d6147;" class=hidden align="left">&nbsp;</td>
             </tr>
            </table>

            %%[next @cnt]%%

                                                <!-- END OF PRODUCT DETAILS --- DUPLICATE FOR EACH PRODUCT WITHIN ORDER -->
           </td>
          </tr>
         </table>

Best Answer

This is not proper syntax:

%%[ if @orderCounter > 0 then do ]%%

Should be this:

%%[ if @orderCounter > 0 then ]%%

You're also missing a <tr> before the cell containing this code:

TOTAL: %%=FORMAT(@orderTotal, "C2")=%%

Not sure what else could be in play since you didn't post all of the email code. The first part of the error says you're missing some required personalization strings, which may be included in the part that's missing.

Related Topic