0

I get the following error when attempting to run an email preview:

The subscriber preview failed to generate. Review the details, correct all issues, and try again.
An unrecognized expression appears in a script block.
Script Expression: “1993”
MemberID: 7273990
JobID: 0

The following AMPScript code was used:

%%[Var @dyr<br>
SET @dyr=[Reunion Year]%%<br>
%%[IF @dyr==“1993” THEN]%%<br> 
   SET @FromName="name1"<br? 
%%[ELSEIF @dyr==“2016” THEN]%%<br>
  SET @FromName="name2"<br>
%%[ELSE]%%<br>
  SET @FromName="default name"<br>
%[ENDIF]%%<br>

what am I doing wrong? How can I fix it?

2

Your code was a mess of syntax issues and a hot mess in general.

  • You had HTML break tags inside the script - which is unnecessary
  • You open/closed the AMPScript brackets multiple times for no reason
  • You did not correctly label the open/close tags for AMPScript - somtimes using %[ or ]% instead of the full %%[ or ]%% syntax.
  • You used the 'magic quotes' as mentioned by @AdrianLarson - which will break inside AMPscript.

Try the below that I rewrote based on your above script:

%%[Var @dyr

   SET @dyr= [Reunion Year]

   IF @dyr=="1993" THEN 

     SET @FromName = "name1"

   ELSEIF @dyr== "2016" THEN

    SET @FromName="name2"

   ELSE

    SET @FromName = "default name"

  ENDIF
]%%
  • Could you maybe throw together a quick explanatory bullet list of the fixes? – Adrian Larson Feb 6 '18 at 21:22
0

Don't use magic quotes (“...”). Use double quotes ("...") or single quotes ('...') instead.

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.