Creating a Dynamic Newsletter with CRM & ClickDimensions

Visit Website View Our Posts

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:

Newsletter Sample


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)


  1. Title (new_title) – Single Line of Text (something reasonable for your layout)
  2. Abstract (new_abstract) – Multiple Lines of Text (a large number)
  3. Graphic Url (new_graphicurl) – Single Line of Text(2000)
  4. 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).


Newsletter HTML

Next, I had to make this markup dynamic by doing the following steps:

  1. 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.
  2. 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.
  3. 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}.
  4. 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.
  5. 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}).


HTML with code replacements made


In the design view of the ClickDimensions editor it should look something like this:


Newsletter Design with Changes


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.


By Ledgeview Partners – Wisconsin based Microsoft Dynamics CRM Partner serving the Midwest and Heartland regions







Show Buttons
Hide Buttons