I want to add some copy into an email only if the boolean (@CPD) in my data extension is TRUE.

Can someone provide me with an example of code to do this? Can I have the copy in the AMPscript of the email? Would this cope with html?

The logic is that that IF a course is certified (@CPD = TRUE), THEN include "this copy here
and this copy underneath"

... I'm not a developer and am self-teaching, so any help would be appreciated!

1 Answer 1


Your answer can be found here: AMPscript issue with a conditional (boolean), but you're thinking in the right direction.

%%[If @CPD Then]%%

Copy to display if boolean is true.


Copy to display if boolean is false; can also be left blank if wanting to display nothing in these cases.


*Making the assumption that you've figured out how to return the value of @CPD in the message. That is, that the lookup part of this process is already sorted out, if not - let me know, I can flesh out the code w/some additional details from you.

  • Thank you so much! This works beautifully! I'd assumed that you'd need some kind of True/False logic, e.g. %%[IF @CPD == TRUE THEN]%% Copy to display if boolean is true. %%[ELSE]%% Copy to display if boolean is false %%[ENDIF]%% Very interested to see that it works without. Really appreciate you taking the time to answer. Commented Apr 25, 2023 at 8:08
  • Annoyingly, I've found that this works in Preview & Test, but not when I have sent tests. The emails will send where the boolean value is False, but not if True. Will report back if I find out a solution (just in case anyone is following this!) Commented Apr 25, 2023 at 10:30
  • Think the issue is with the copy (emails will send if I remove this) >> Possibly an issue with the copy breaking up the ampscript. Commented Apr 25, 2023 at 10:41
  • Hi @KatiePorteous - can you validate that the variable is producing a value? That is, remove the If/Else and instead have %%=v(@CPD)=%% in the email to make sure a value is coming through. Additionally, when you say it works in tests previews, but not the send - is the email failing, or is it delivering not respecting the code? Commented Apr 28, 2023 at 15:42

You must log in to answer this question.

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