I'm just trying to practice a simple Lookup function. I event looked at AMPscript lookup Examples. However I do not understand what is wrong with my AMPscript-code.

I'm getting this error below from SFMC:

Unable to generate preview

Personalization error: %%program_cd%% To fix the problem, please try the following: - Make sure that there is not a space or typo within the personalization string in your email. For example, check and correct any spaces between percent signs (%%) - Correct the HTML Body of your email.

my code:

    var @offer, @lookupvalue
    set @lookupvalue = AttributeValue("BannerURL")
    set @offer = Lookup("DE", "Offer", "BannerURL", @lookupvalue)

  • It seems like this isn't the complete code of your email as the personalization string mentioned in the error message isn't part of the shared code. The personalization string %%program_cd%% seems to be invalid. May 2, 2017 at 16:09
  • @MarkusSlabina uncompleted code? I followed Adams Spriggs AMPscript Lookup Examples, and I believe that he will not give a halfway example on how to properly utilize the Lookup function. The only difference between his example and mine is the variables name are changed to match my DE.
    – A1_ren
    May 2, 2017 at 16:23
  • 2
    The AMPscript code is complete and seems fine but the error message suggests that there is additional personalization in the email that is causing the error and not the code of Adam's example. This could also be part of the header/footer configured in your sender profiles. May 2, 2017 at 16:25
  • @MarkusSlabina Got it! I'll try on a plain template to see if this fix the issue here. Is there any other software where you could test apart AMPscript code beside in SFMC app?
    – A1_ren
    May 2, 2017 at 16:30
  • I'm afraid there isn't, or at least I don't know any program like this. May 2, 2017 at 16:32

1 Answer 1


It seems like the error isn't in the AMPscript-code you provided, but rather in the rest of the email, which contains the invalid personalization string %%program_cd%%. This could be in any content block, template or even the header/footer configured in your sender profile.

Try a plain email without any template and if this doesn't work check your header/footer configuration for further debugging.

  • 1
    This is the reason you should never use raw personalization strings in your code. It's the reason I always set a variables and use AttributeValue() to retrieve the value for each string. May 2, 2017 at 16:43

You must log in to answer this question.

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