Apologies if I'm not explaining this very well but I am pretty new to AMPScript.

So what I'm trying to achieve is basically dynamic content. If a person's course in the data extension matches what I am querying in my code then I would like the content to be displayed.

I've managed to do something similar with "ContentBlockByKey" but I need it to display an Email message (not a content block) hence why I am using AMPscript for this and not the dynamic content features in MC. Is this possible? I see something called AssetID and EmailID on the Email Message but just not sure how to pull it in.

Here's a code snippet:

SET @attr = Lookup('Base Data Extension','Course','Person Contact ID',_SubscriberKey)

IF @attr == 'Art' THEN
SET @thumbnail = ContentBlockByKey("c4ef80b7-00c2-4391-8b8b-7f62ef6dc91f")
SET @thumbnail = ContentBlockByKey("383b21e9-656f-4adb-a238-5ffb37fce323")

  • So, what you want to do, is to show a complete email within another email? Jun 28, 2022 at 14:23
  • Thats right, see my comment below about using decision splits and why I’m looking at ampscript as a option
    – Jake
    Jun 28, 2022 at 16:50
  • This is not a viable solution. You would normally have build your emails dynamically, replacing few content blocks depending on the nature of the email you wish to send. There is no way of using ampscript to get the complete HTML of an email in content builder, and having this content placed in another email. Jun 29, 2022 at 7:10
  • Fair enough. The only reason I didn't build them dynamically is that the whole email is different. How would you address a track that had 40 variants for 1 email and 20 for the next?
    – Jake
    Jun 29, 2022 at 7:35
  • The whole point of Content Builder is the ability of replace selected parts of the email, making it as reusable as possible. Allowing you to have a single template, and include/exclude content blocks where needed. Your case sounds like the emails you are using have all probably been built using HTML paste method, taking away the benefits of content builder. Jun 29, 2022 at 14:02

1 Answer 1


This could easily be accomplished with Journey Builder, rather than AMPScript.

  1. Users would enter the Journey when they are added to the specific Data Extension
  2. A Decision Split would determine the Course
  3. The appropriate Email would be sent based on the Decision Split

In regards to Dynamic Content and AMPScript, it is best to have 1 Email Content, and several Content Blocks that can be used dynamically using AMPScript.

enter image description here

  • Ah I should have mentioned, there would be around 40 decision splits for the first email and then 20 something for a email later in the journey and your limited to 20 decisions on Journey builder right? I could have multiple decision splits true but I think that could get quiet messy hence why I wanted to do something with ampscript.
    – Jake
    Jun 28, 2022 at 16:48

You must log in to answer this question.

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