I'm new to SFMC and learning AMPSCRIPT. I am getting the following error when previewing.
The subscriber preview failed to generate. Review the details, correct all issues, and try again.
There is an error in your email. Please contact your customer service representative.
Error 1: Script SET Statement Invalid<br>An error occurred when attempting to resolve a script expression. See inner exception for detail.
Script Expression: [Contact:Id] MemberID: 7291454 JobID: 0
The Journey Builder entry events primary object is Opportunity. I've tried setting the attribute to Opportunity:id
. I then tried setting it to Contact: id
. Both time I got errors.
Here is the AMPSCRIPT I'm using. Note: I didn't create it so I don't understand it fully. But, I'm trying to understand it. Any help is appreciated.
%%[
/* AMPscript pulls in the values associated with Salesforce Object triggering the send */
/* Fields will be populated by trigger data. RecordId = Contact ID in SFDC */
/* Contact:Id column is used to determine the rest of the information to look up the Loan Officer info */
SET @Id = [Contact:Id]
SET @FirstName = [Contact:FirstName]
SET @EmailAddress = [Contact:Email]
SET @OwnerID = Lookup("Opportunity_Salesforce","OwnerId","Primary_Contact__c",@Id)
SET @OwnerRow = RetrieveSalesforceObjects("User", "NMLSNumber__c, FirstName, Name, Phone, MobilePhone, Fax, Email, Bio_Link__c", "Id","=",@OwnerId)
IF RowCount(@OwnerRow) > 0 THEN
SET @NMLSnumber = Field(Row(@OwnerRow,1),"NMLSNumber__c")
SET @LOFirstName = Field(Row(@OwnerRow,1),"FirstName")
SET @LOFullName = Field(Row(@OwnerRow,1),"Name")
SET @LODirect = Field(Row(@OwnerRow,1),"Phone")
SET @LOMobile = Field(Row(@OwnerRow,1),"MobilePhone")
IF Length(@LOMobile) > 10 THEN
SET @LOMobile = Substring(@LOMobile,4,10)
ENDIF
SET @LOFax = Field(Row(@OwnerRow,1),"Fax")
SET @LOEmail = Field(Row(@OwnerRow,1),"Email")
SET @LOBioLink = Field(Row(@OwnerRow,1),"Bio_Link__c")
ELSE
ENDIF
]%%