0

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)
]%%

%%=v(@offer)=%%
  • 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. – Markus Slabina May 2 '17 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 '17 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. – Markus Slabina May 2 '17 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 '17 at 16:30
  • I'm afraid there isn't, or at least I don't know any program like this. – Markus Slabina May 2 '17 at 16:32
2

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.

| improve this answer | |
  • 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. – Adam Spriggs May 2 '17 at 16:43

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.