Home | Dynamic Content | Merge any custom or standard entity data into ClickDimensions emails

Merge any custom or standard entity data into ClickDimensions emails

An updated version of this post can be found here

Recently we had a prospect (now customer J ) that wanted to have standard email templates which could bring in data from standard and custom entities. But there was a twist; they also wanted to be able to bring in multiple records for some entities. Here is the scenario: the customer is in the home building industry and they wanted to have a standard template which could contain information about the recipient the template was being sent to as well as information about a specific subdivision and various homes in that subdivision.

A simplified version of the email template in question is pictured below. This could easily be complex HTML with graphics and formatting but we are using this example for simplicity. You can see that in line 1 it brings in the recipient's (contact) full name. Then, in the next line it brings in the name of a subdivision (a custom entity) and then a table with information about that subdivision. Below that the email template will include information about one or more homes records. This is achieved by using the Freemarker list directive. Freemarker is an open source template markup language that the ClickDimensions email engine employees for complex dynamic content capability.

The data fields in the template can come from any custom or standard field or entity in CRM. You add fields by simply using the same syntax that our standard data fields use. For example, ${Recipient.lead.firstname[0]!""} represents the first name field on the lead record. Following this syntax we can include any data in the template. For example, if you have a custom entity named new_subdivision with a field named new_name you can place the data field ${Recipient.new_subdivision.new_name} into your template (note that the characters [0]!"" at the end of the lead first name field are optional).

Below is what the custom subdivision entity looks like. Note that it has paths to images of the subdivision. Note that it also has home records linked to it (Home is also a custom entity).

Below is what the Home custom entity looks like. It also has paths to image files…

Now that the Email Template is ready we need a way to specify which subdivision and which homes should be merged into the template. We do this by using the CRM connections feature. We simply link a subdivision and one or more home records to the ClickDimensions Email Send record using the standard CRM connections functionality on the Email Send record. In the case of our subdivisions/homes example we will link a subdivision record to the ClickDimensions Email Send record…

And then we will link any number of homes records to the ClickDimensions Email Send record. The result is that we have one subdivision and several homes records linked to the Email Send record…

Of course, the Email Template we showed above is also linked to the ClickDimensions Email Send record…

Now we just add some recipients (Leads, Contacts, Accounts and/or Marketing Lists in any combination) and when we send our email all the data from the recipient, subdivision and homes records is merged into the resulting email. Again, this was not meant to be a fancy email but we could just as easily have formatted it any way we wanted.

This has been a complex example but hopefully you are seeing the power of our merging capability as well as the advantages we have by enabling dynamic content through the Freemarker language. Happy marketing!

About the Author:

The ClickDimensions marketing team is committed to helping marketers using Microsoft Dynamics 365 achieve their goals.


  1. Michael Cross October 16, 2011 at 10:09 am - Reply

    We have a custom entity with several different child entities, and we want to generate an e-mail that includes records from each of the different entities (similar to an Order Header and Order Lines). Can the records from the various child entities be included without having to use the Connections?

  2. Tony Berry March 22, 2012 at 6:51 pm - Reply

    Did this ability to reference child records without a connection get implemented? We have a similar need and would be very interested in the solution.

  3. ClickDimensions March 28, 2012 at 2:48 pm - Reply

    @Tony: We haven’t implemented this functionality though it is something we are continuing to investigate.

  4. Stuart_UEL October 7, 2012 at 5:11 pm - Reply

    We have a need to merge in data from multiple child records in a custom entity related to the lead entity. Connecting the records wouldn’t be practical as the email sends will be to hundreds/thousands of lead records and triggered by workflow. Is this functionality available now or is it something we could script using Freemarker?

  5. Tom Spikings January 29, 2013 at 6:32 am - Reply

    We would also be able to derive enormous value from being able to list a related entity when sending email. The above is also very useful.

  6. Tomasz Romanowski October 21, 2014 at 11:59 pm - Reply

    @ClickDimensions: Is the feature allowing content from entities related through 1:N relationship to Contact, that is child entities to Contact, available with the current release of CD?

    I have Contact entity and related entity e.g. Product, with a lookup to Contact, and would like to include in email template a value from one of these related records.


    thank you for traveling to PRODUCT.NAME.

    Please let me know how to best implement it.

  7. ClickDimensions October 22, 2014 at 4:36 pm - Reply

    Yes, you can do that as long as you connect the Product to the Email Send record using the CRM Connections.

  8. Bj Walbaekken October 29, 2014 at 5:15 pm - Reply

    Is it possible to make a lot of connections but filter the list. i.e. connect all houses in a major area, then section each list by “Here is the information in redfield” (showing only redfield filted list) an then another section “You may also be interested in…” (all excluding redfield)

  9. ClickDimensions November 3, 2014 at 2:19 pm - Reply

    Unfortunately, it does not appear that there is a way to do this. We have tried situations like this before and have not succeed in making the if statements filter the list.

Leave A Comment