Placeholders allow a template within a template. If a dynamic template is selected during the creation of a new communication, the communication panel will prompt for the content that should be placed in the placeholder.

When the template is used by a communication, the user will be asked to fill in a value for the placeholder, which will be substituted into the template at this location.

Usage

Inside your template, placeholders can be used by inserting a <@placeholder /> tag with the following attributes.

Tag Attributes:

Attribute Required Description
name Required The name of the variable the placeholder content will be stored. Must be only alphanumeric characters and not start with a number.
type Required
text:
A simple text field
richtext:
A content editor which allows for formatted text
help Optional Placeholder text that appears in the content input field if the type is text. For richtext fields, the help text appears below the editor.
group Optional Allows placeholders to be grouped together. If you have a number of related placeholders (e.g. imageSourceUrl, imageAlt, imageLinkUrl) then all of those would be grouped together in the editor.
default Optional The default text you want to populate into the placeholder when prompted.

Examples

Example 1: Prompt for rich text editor

This template is an example of prompting for a single rich text editor.

<p>Dear ${firstName},</p>

<@placeholder name="content" type="richtext" />

This will result in a Simple Communication editor with a single rich text editor.

Example 2: Prompt for mix of rich text and plain text inputs

This template contains a mix of prompts.

<div style="margin: 10px;">
    <img src="<@placeholder name="bannerImageUrl" type="text" />" alt="<@placeholder name="bannerImageDescription" type="text" />" />
</div>

<p>Dear ${firstName},</p>

<@placeholder name="content" type="richtext" />

This will result in a Simple Communication editor with two plain text prompts for the image URL and image alt text and a single rich text editor for the message main content.

Check for Existence

There might be situations where you have a placeholder inside of some other content and you might not want to print the surrounding content. A common example would be using a placeholder to prompt for an image URL or image alt tag. In those cases where the placeholder is optional, you wouldn't want to print the surrounding text if no values are supplied for those placeholders.

Consider this example template where we are collecting an image URL and alt text. In the event that values are not supplied for those two placeholders, you would end up with a img that has an invalid URL as the src attribute would be empty.

<img src="<@placeholder name="imageUrl" type="text" />" alt="<@placeholder name="imageAlt" type="text" />" />

Instead, you can wrap the block of content with an if/else/elseif and Check for null. All placeholders are collected and prefixed with placeholder_ so they can be evaluated for null by Freemarker.

<#if placeholder_imageUrl??>
    <img src="<@placeholder name="imageUrl" type="text" />" alt="<@placeholder name="imageAlt" type="text" />" />
</#if>