For SFMC Email Studio, i have create a Template-Based Email, I have also create a Content Block which uses the placeholder %%firstname%% to return the text True if it is not empty and False if it is empty. The Email is called EmailA and the Content Block is called has_firstname

Within EmailA, i have added the following

My name is Mike and what i say is %%has_firstname%%, thank you for listening.

I'm not sure what this would be called in SFMC, but to me this is called inlining a content block. However this does not seem to work. The only thing i can seem to do is drag and drop content on top of each other.

Is there any way to call the Content Block as a variable or function? I do NOT want to have inline Placeholder logic or AMP Script within the template itself. I want that logic to be in a Content Block or something else which i can easily inline.

Thank you.

3 Answers 3


You reference external Content Blocks using the ContentBlockByKey, ContentBlockByName and ContentBlockByID functions.

For example:

My name is Mike and what I say is %%=ContentBlockByName("My Contents\has_firstname")=%%, thank you for listening

Also, following the #NoNakedPersonalizationStrings principle, your content block should reference first_name something like this:


var @first_name
set @first_name = AttributeValue("first_name")

if not empty(@first_name) then
  set @first_name = propercase(@first_name)

  • 1
    NOOO. We did it again. You got me by 40 seconds this time lol Mar 25, 2020 at 14:14
  • fantastic, thank you so much!
    – user80446
    Mar 25, 2020 at 15:54

The '%%text%%' is actually for 'Personalization Strings' and not any functions or calls.

That is not to say that your request is not possible, but it will require AMPscript in order to accomplish.

Basically you will want to utilize the ContentBlockByName, ContentBlockByID or ContentBlockByKey functions to call your block.

To note as well, if you want to utilize this content block inline, you NEED to make sure to set it up as a Code Snippet block. Any other block has html that is prepended and appended to the block prior to insertion into content.

I would highly recommend utilizing ContentBlockByID as the ID will never be changed for that Content Block, but the name and/or key can be changed and make the call invalid or require an update of the content block call to make it work.

Basically something like:
My name is Mike and what i say is %%=ContentBlockByID(12345)=%%, thank you for listening.

  • 1
    LOL. "After you." "No, after you." Mar 25, 2020 at 14:13
  • Please tell me you're not on vacation both of you and are answering questions here XD That was quick! Mar 25, 2020 at 14:15
  • Gotta keep busy somehow with all the mess going on lol Mar 25, 2020 at 14:18
  • 1
    Both of your answers were extremely helping, the one thing i felt you did better was to mention the Code Snippet part. I wish i could give you both approved answers. Thank so much!
    – user80446
    Mar 25, 2020 at 19:22

has_firstname would be a personalization string, which means it directly references either an attribute from the All Subscribers list or from the Data Extension being used to send the email. In order to check if the Firstname field was empty or not you would need to write some form of AMPScript to check this first and assign it to a variable. Or there are inline functions to help with this.

  SET @firstname = [firstname]
  SET @has_firstname = Empty(@firstname)

Then output inline using: %%=v(@has_firstname)=%%

Or using inline functions:

%%=IIF(EMPTY(firstname),'false', 'true')=%%
  • thanks a lot for that comment, is this amp script or?
    – user80446
    Mar 25, 2020 at 19:45
  • @Jordan yes this is AMPScript Mar 25, 2020 at 19:57

You must log in to answer this question.