1

Please help me figure out the problem in my ampscript.

So here it is:

%%[ Var @phone Set @phone = Lookup(“Support Phone Numbers”, “Phone”, “Locale”, "%%Opportunity:Account:Locale__c%%") ]%%

The result of the script is placed in email like this:

%%=v(@phone)=%%

But when I try to preview the email I get this error:

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: Lookup(“Support Phone Numbers”, “Phone”, “Locale”, "%%Opportunity:Account:Locale__c%%") MemberID: 7295734 JobID: 0

The specified attribute or custom object field name was not found for this client. Function Call: Lookup(“Support Phone Numbers”, “Phone”, “Locale”, "%%Opportunity:Account:Locale__c%%") Attribute or Field Name: “Support

Invalid Content: Set @phone = Lookup(&#“;Support Phone Numbers&#”;, &#“;Phone&#”;, &#“;Locale&#”;, "%%Opportunity:Account:Locale__c%%")

Here are the screenshots: template code

error message

Oleg Rogachov
  • 11
  • 1
  • 2
  • Have you tried it without the quotes on Opportunity:Account:Locale__c? I don't think you need the wrapping %% either. – edu8rdo Mar 16 '17 at 15:56
  • Thanks for help. Here is how it must be: Lookup("Support Phone Numbers","Phone","Locale",[Opportunity:Account:Locale__c]) – Oleg Rogachov Mar 16 '17 at 16:09
  • You'll get a lot more eyes on your SFMC questions over at [salesforce.stackexchange.com](http://salesforce.stackexchange.com), specifically with the [marketing-cloud](http://salesforce.stackexchange.com/questions/tagged/marketing-cloud) and [ampscript](http://salesforce.stackexchange.com/questions/tagged/ampscript) tags. – Adam Spriggs Mar 16 '17 at 16:27

1 Answers1

0

The issue appears to be caused by the 2 different styles of double quotes (") being utilized within the function.

For instance:

Lookup(“Support Phone Numbers”, “Phone”, “Locale”, "%%Opportunity:Account:Locale__c%%")

Should look like:

Lookup("Support Phone Numbers", "Phone", "Locale", "%%Opportunity:Account:Locale__c%%")

Also there is the was a problem with %% wrapping for Opportunity:Account:Locale__c

Finally the script should look like this:

Lookup("Support Phone Numbers","Phone","Locale",[Opportunity:Account:Locale__c])

Thanks.

Oleg Rogachov
  • 11
  • 1
  • 2