0

I have a content block that sets an attribute from a data extension in a variable and then has several lookups based on that.

When I preview and test send it works but in live sends I'm getting a triggered send error that say it cannot find the attribute even though it is clearly in the receiving data extension.

This is the error code:

--- inner exception 1---

ExactTarget.OMM.OMMException: An error occurred when attempting to parse HtmlEmailBody content for HTML content. MemberID: 7295256 JobID: 247189 ListID: 51 Content Begins With:

--- inner exception 2---

ExactTarget.OMM.InvalidScriptException: The SET variable value expression is invalid. See inner exception for detail. Script: Set @LoanId = LoanId Variable Name: @LoanId Index: 235 ListID: 51 Error Code: OMM_VAR_SET_EXPR_INVALID - from OMMCommon -->

--- inner exception 3---

ExactTarget.OMM.InvalidScriptException: An error occurred when attempting to resolve a script expression. See inner exception for detail. Script Expression: LoanId MemberID: 7295256 JobID: 247189 Error Code: OMM_SCRIPT_SYNTAX_ERR - from OMMCommon -->

--- inner exception 4---

ExactTarget.OMM.InvalidScriptException: An unrecognized expression appears in a script block. Script Expression: LoanId MemberID: 7295256 JobID: 247189 Error Code: OMM_SCRIPT_SYNTAX_ERR - from OMMCommon

This is my Ampscript block:

%%[
VAR @LoanId
,@tablewidth
,rsLoan
,@OwnerId
,@rsUsers
,LOFirstName
,@LOLastName
,@LOTitle
,@LO_NMLS_Number
,@LOStreet
,@LOCity
,@LOState
,@LOPostalCode
,@LOPhone
,@LOMobilePhone
,@LOFax
,@Maxwell
,@LEmail
,@LOEmail
,@LO_Branch_URL
,@LOBranch_NMLS_Number
,@LO_Photo 
,@LOTeamName

/* Find LO Info */
/* Find OwnerID - Look in Loan */
Set @LoanId =LoanId
Set @tablewidth = "100%"
Set @rsLoan = LookupRows("CCM_Loan__c_Salesforce","ID",@LoanId)
If RowCount(@rsLoan) > 0 Then
 Set @OwnerID = Field(Row(@rsLoan,1),"OwnerID")

EndIf

/* Find user info */
If Not Empty(@OwnerID) Then
 Set @rsUsers = LookupRows("User_Salesforce","Id",@OwnerID)
 if RowCount(@rsUsers) > 0 then
  Set @LOFirstName = Field(Row(@rsUsers,1),"FirstName")
  Set @LOLastName = Field(Row(@rsUsers,1),"LastName")
  Set @LOTitle = Field(Row(@rsUsers,1),"Title")
  Set @LO_NMLS_Number = Field(Row(@rsUsers,1),"LO_NMLS_Number__c")
  Set @LOStreet = Field(Row(@rsUsers,1),"Street")
  Set @LOCity = Field(Row(@rsUsers,1),"City")
  Set @LOState = Field(Row(@rsUsers,1),"State")
  Set @LOPostalCode = Field(Row(@rsUsers,1),"PostalCode")
  Set @LOPhone = Field(Row(@rsUsers,1),"Phone")
  Set @LOMobilePhone = Field(Row(@rsUsers,1),"MobilePhone")
  Set @LOFax = Field(Row(@rsUsers,1),"Fax")
 /*Set value to check*/
  Set @Maxwell = 'maxwellmortgageloans'
  /* set the string to check*/
  Set @LEmail = Field(Row(@rsUsers,1),"Email")
  /*Does it match*/
  if IndexOf(@LEmail,@Maxwell) > 0 then 
  Set @LOEmail = Propercase(@LEmail)
  else
  Set @LOEmail = @LEmail  EndIf
  Set @LO_Branch_URL = Field(Row(@rsUsers,1),"LO_Branch_URL__c")
  Set @LOBranch_NMLS_Number = Field(Row(@rsUsers,1),"Branch_NMLS_Number__c")
  Set @LO_Photo = Field(Row(@rsUsers,1),"CC_PhotoURL__c")
  Set @LOTeamName = Field(Row(@rsUsers,1),"Team_Name__c")
 EndIf 
EndIf
]%%
%%[If Not Empty(@OwnerID) Then]%%
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td style="padding: 0 40px 0 40px;" class="paddingLeft20 paddingRight20">
      <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-top: 1px solid #dddddd;">
        <tr>
          <td style="padding: 40px 0 0 0;">
   %%[If Not Empty(@LO_Photo) Then]%%
            <table width="0%" border="0" align="left" cellpadding="0" cellspacing="0" class="container">
              <tr>
                <td align="left" style="padding: 0 15px 15px 0;">
                  <img src="%%=v(@LO_Photo)=%%" alt="%%=v(@LOFirstName)=%% %%=v(@LOLastName)=%%" width="140" height="200" style="height:200px;width:140px;" data-assetid="6782">
                </td>
              </tr>
            </table>
   %%[EndIf]%%
            <table width="55%" border="0" align="left" cellpadding="0" cellspacing="0" class="container">
              <tr>
                <td align="left" style="line-height: 18px; font-size:12px; color:#000000; font-family:verdana,geneva,sans-serif;">
                  %%[If Not Empty(@LOFirstName) and Not Empty(@LOLastName) Then]%%%%=v(@LOFirstName)=%% %%=v(@LOLastName)=%%
                  <br>
      %%[EndIf]%%

                  %%[If Not Empty(@LOTeamName) Then]%%%%=v(@LOTeamName)=%%
                  <br>
      %%[EndIf]%%

                  %%[If Not Empty(@LOTitle) Then]%%%%=v(@LOTitle)=%%
                  <br>
      %%[EndIf]%%
      %%[If Not Empty(@LOPhone) Then]%%
                  D: 
                  <a href="tel:%%=v(@LOPhone)=%%" target="_blank" style="text-decoration: none; color: #000000">%%=v(@LOPhone)=%%</a>
                  <br>
      %%[EndIf]%%
      %%[If Not Empty(@LOMobilePhone) Then]%%
                  M: 
                  <a href="tel:%%=v(@LOMobilePhone)=%%" target="_blank" style="text-decoration: none; color: #000000">%%=v(@LOMobilePhone)=%%</a>
                  <br>
      %%[EndIf]%%
      %%[If Not Empty(@LOFax) Then]%%
                  F: 
                  <a href="tel:%%=v(@LOFax)=%%" target="_blank" style="text-decoration: none; color: #000000">%%=v(@LOFax)=%%</a>
                  <br>
      %%[EndIf]%%
      %%[If Not Empty(@LOEmail) Then]%%
                  <a href="mailto:%%=v(@LOEmail)=%%" style="color: #000000; text-decoration:none" target="_blank" title="">%%=v(@LOEmail)=%%</a>
                  <br>
      %%[EndIf]%%
                  %%[If Not Empty(@LO_NMLS_Number) Then]%%NMLS %%=v(@LO_NMLS_Number)=%%<br>%%[EndIf]%%
                </td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td align="left" ;="" style="line-height: 18px; font-size:12px; color:#000000; font-family:verdana,geneva,sans-serif; padding: 0 0 40px 0"> CrossCountry Mortgage, Inc.
            <br>
            <a href="" target="_blank" style="text-decoration: none; color: #000000; cursor: default;" alias="Branch Address">%%[If Not Empty(@LOStreet) AND NOT EMPTY (@LOCity) AND NOT EMPTY (@LOState) AND NOT EMPTY (@LOPostalCode) Then]%%%%=v(@LOStreet)=%%%%[EndIf]%%
              <br>
     %%[If Not Empty(@LOStreet) AND NOT EMPTY (@LOCity) AND NOT EMPTY (@LOState) AND NOT EMPTY (@LOPostalCode) Then]%%%%=v(@LOCity)=%%, %%[EndIf]%%%%[If Not Empty(@LOStreet) AND NOT EMPTY (@LOCity) AND NOT EMPTY (@LOState) AND NOT EMPTY (@LOPostalCode) Then]%% %%=v(@LOState)=%%&nbsp;%%[EndIf]%%%%[If Not Empty(@LOStreet) AND NOT EMPTY (@LOCity) AND NOT EMPTY (@LOState) AND NOT EMPTY (@LOPostalCode) Then]%%%%=v(@LOPostalCode)=%%%%[EndIf]%%</a>
            <br>
   %%[If Not Empty(@LO_Branch_URL) Then]%%
            <a href="%%=RedirectTo(@LO_Branch_URL)=%%" alias="Branch URL" style="color: #000000; text-decoration:none;" target="_blank" title="">%%=RedirectTo(@LO_Branch_URL)=%%</a>
            <br>
   %%[EndIf]%%
            %%[If Not Empty(@LOBranch_NMLS_Number) Then]%%NMLS %%=v(@LOBranch_NMLS_Number)=%% NMLS 3029%%[EndIf]%%
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
%%[EndIf]%%


%%[/*Apply now button*/ IF NOT EMPTY(@LO_Branch_URL) Then]%%
<table border="0" cellspacing="0" cellpadding="0" align="left">
  <tr>
    <td bgcolor="#ffffff" align="left" style="padding: 0px 0px 20px 40px;">

<table border="0" cellspacing="0" cellpadding="0" align="left">
  <tr>
    <td bgcolor="#3daf2c" align="center" style="font-family:verdana,Trebuchet MS, Arial; border-radius: 5px; moz-border-radius: 5px; font-size:16px; font-weight:700;  color:#ffffff;  display:block;  text-align: center; padding: 15px  20px 15px 20px;"><a alias="ApplyNow" class="hover-me-1" conversion="false" data-linkto="other" href="%%=RedirectTo(@LO_Branch_URL)=%%" target="_blank" title="ApplyNow" style="color:#ffffff; text-decoration:none; display:inline-block; width:100%;">Apply Now</a></td>
  </tr>
  </table></td></tr></table>
%%[ENDIF]%%
  • Have you verified that all the subscribers you are sending via the TSD do have a LoanID? or is it failing with that error message on records you know contain the LoanID? – Gortonington Dec 13 '18 at 21:59
  • 2
    One comment: Do not expose customer or your own data on public platforms. This is not a good idea especially with gdpr. – Johannes Schapdick Dec 14 '18 at 7:22
  • @Gortonington It's failing on records I know (and checked) have a LoanId populated in the source data extension. – Stephanie Wood Dec 14 '18 at 15:16
  • Try using SET @LoanId = AttributeValue("LoanId") this should remove the error of invalid set due to AttributeValue having null handling - and from there you can verify if the LoanId is coming through empty or if there is another issue. – Gortonington Dec 17 '18 at 20:51
0

Usually I look around the lines where the errors are stated, because it's usually something before or after that causes the AMPScript to jam up. That tips me off to you setting your table width to "100%". It's possible setting that percent symbol in the variable is throwing something off in your script. Maybe put the % outside of ampscript and just set the value to 100 just to rule that out.

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.