In today’s business environment, marketing teams are like a lot of other teams, they are trying to do more with less. As additional marketing outlets become available through the advent of social media, marketing teams are pushed to do even more with less. How is this possible? What will be the outcome? For our company, marketing is only possible with useful software tools like Microsoft CRM and ClickDimensions.
It stands to reason then that our marketing team asked me to put together an easy to maintain newsletter template that can generate dynamic content while using ClickDimensions as the template engine. Here is an example of an existing template that they wanted me to try to replicate:
If you notice this is a pretty complicated layout. It requires multiple news articles with alternating rows switching the image from side to side. Another important requirement from our marketing team is that the content be dynamic and stored in CRM. For example, one month the newsletter may have three articles; one month the newsletter may have six articles. The template needs to be built to handle this dynamic nature without relying on marketing to add or remove article sections. All article information is stored in custom entities in CRM, as we have extended this beyond normal CRM needs.
ClickDimensions uses an open source template engine called FreeMarker. FreeMarker is extremely flexible and allows ClickDimensions to render incredibly complex email templates. It can do stuff like define variables, iterate through lists of records, use conditionals and output values.
To create this template, first we need an entity in CRM to store the title of the article, text of the abstract, the image URL and a link to the full article. Here is the entity I created:
Entity Name: Newsletter Content (new_newscontent)
Attributes:
Title (new_title) – Single Line of Text (something reasonable for your layout)
Abstract (new_abstract) – Multiple Lines of Text (a large number)
Graphic Url (new_graphicurl) – Single Line of Text(2000)
Link (new_link) – Single Line of Text (2000)
Make sure to click the “Connections” check box (we’ll need this later to associate the records to a ClickDimensions Email Send).
Next, create a new ClickDimensions Email Template. Switch to the HTML view of the ClickDimensions Free Style editor.
Because this newsletter template has alternating images, I had to adjust the markup. I copied a table cell containing a right image and pasted the markup into a table with an existing left image. Then I deleted the rest of the example rows. When I was done I ended up with the following html (see the image below).
Next, I had to make this markup dynamic by doing the following steps:
Add a tag before the html table: <#assign i = 0/> . This creates a new variable named “i”. This will be used to track the row so we can alternate the images on the left and right of the email.
Surround the repeated markup with the following tags: <#list Recipient.new_newscontent as news>PUT REPEATED CONTENT IN BETWEEN THESE TAGS</#list>. The #list tag starts a loop. In this case it loops through the new_newscontent records connected to the current Email Send record.
Replace the src attribute of the images with a placeholder, ${news.new_graphicurl}. This uses the attribute Graphic Url for the location of the image in the newsletter. Replace the “Article Title” with ${news.new_title}, the “Read more” anchor’s href attribute with ${news.new_link}, and the abstract text with ${news.new_abstract}.
Surround the first table cell with the following tags: <#if i % 2 = 0>PUT THE TABLE CELL IN BETWEEN THESE TAGS</#if> . The #if is a FreeMarker conditional statement. if the condition is true the contents are rendered. If not then nothing is rendered. Do the same thing to the last table cell, but adjust the #if condition so that instead of “i % 2 = 0” it is now “i % 2 = 1”. This will make the first image display on even (or zero) rows and the second image display on odd rows.
Finally, add the following tag to increment the variable “i” as you loop through the connected News Content records: <#assign i = i + 1 />. #assign sets the value of an existing variable to something. In this case it assigns i + 1 to i.
The template should look similar to this when you are done (NOTE: I used some slightly different names for my entity and attributes than I do in the article, we also have a page on our website that will pull news articles from our CRM so I don’t replace the whole Read more anchor’s href attribute with ${news.new_link}).
In the design view of the ClickDimensions editor it should look something like this:
I recommend you test out this new template before handing it over to your marketing team. To do this, create an Email Send as you would normally do to send a ClickDimensions email. When the Email Send is saved, click Common -> Connections in the “Related” tree (on the left). Then click “Connect” in the Ribbon.
Click the “Name” lookup and choose a “Newsletter Content” record from the lookup box. Then click “Save & Close” in the Ribbon. Connect as many “News Content” records as you want to appear in the newsletter email. Send yourself a test email to see how your newsletter looks.
Voila! You have now created an easy to use, flexible newsletter template for months to come.
This is just one example of how to create dynamic content in an email template. ClickDimensions’ email templates are extremely powerful and flexible. If you are interested in learning more about these templates and what you can do with them, here are some other good articles about customizing ClickDimensions templates:
Want to learn more about other marketing automation suggestions? Join us on March 7th for a ClickDimensions webinar as we learn more ways to stretch our marketing dollars with simple automations.
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.