Just starting with AMPscript but cannot render the output on this simple script. The code appears in the email instead of the output. Can anyone see what I am doing wrong? thanks

set @test = "123"

IF @test == "123" THEN
 set @response = "Hello World!"
 set @response = "Goodbye"

1 Answer 1


The AMPscript looks correct, maybe one thing I’d change would be to make sure you are using " or ', not , but that would not cause the issue you have described.

My assumption is that you are using the wrong content block and displaying the code as content instead of actually rendering it. I advise using a code snippet block or if you’d like to use a different one, to edit the AMPscript in the html/code view of the content block, not in the WYSIWYG editor.

Another reason for this might be that you are previewing your email without a subscriber: https://help.salesforce.com/s/articleView?id=sf.mc_es_subscriber_preview_test_send.htm&language=en_US&type=5

  • thanks. I used a HTML block. I changed the quotes as well but still the same. Is there a setting anywhere that I may have missed? Commented May 5, 2023 at 14:59
  • Are you doing a subscriber preview against a data extension?
    – zuzannamj
    Commented May 5, 2023 at 15:54
  • no, just created code and clicked Next Commented May 5, 2023 at 16:48
  • Then that’s it. Please see the link I posted in my reply to see how to test it correctly
    – zuzannamj
    Commented May 5, 2023 at 17:01
  • thanks. I did try with a subscriber but got many errors (red). I will work through them to see what the issue is. Commented May 5, 2023 at 18:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .