Using ClickDimensions to create Emails, an exploratory testing adventure

Using ClickDimensions to create Emails, an exploratory testing adventure
It’s always fun to make new acquaintances, sometimes it’s more fun than others. Creating an email template is easy if you keep it to the paved roads, but it’s when you go off road the real fun stuff happens.

So I was given that task of getting data to an email template to ClickDimensions, so I thought that sounded easy enough, well there was a hook to it (there always is when I’m GIVEN a task 🙂 ).

Consider this scenario, a customer orders something and you want to send them confirmation email greeting the customer and confirming everything. So you want to add some data that is not related to customer directly and instead is on your custom entity, with some other details that you want to present in a table like fashion. What if you have your custom entity, let’s call it new_order and you have details new_orderdetail in a 1:N relationship from order to order details.

This can be done using ClickDimensions and the templating engine that they use called FreeMarker. Since I wasn’t sure how to use these tools together I turned to their support and got good response with a blog post that they have done themselves. Great!

http://blog.clickdimensions.com/2011/10/merge-any-custom-or-standard-entity-data-into-clickdimensions-emails.html

However this is from 2011 and as of this blog post it’s October of 2014.
The principals are the same, add connections to your Email Send record and then manually add FreeMarker template markup to get the data into the email itself.
To my example email, I wanted to do something like this:
“Hi Account.Name
We have received your order {new_order.name} this is including:
<Table of new_orderdetail>
{new_orderdetail.name} {new_orderdetail.amount}
</Table of new_order>”
The first part was straight forward, however the table part was not so easy. Now this is what I figured out. FreeMarker has to somehow “expand” the attributes that you are going to use before you loop them. I’m not sure why. But this worked for me:

“Hi ${Recipient.account.name}
We have received your order ${Recipient.new_order.new_name}, this is including:
<#list ${Recipient.new_orderdetail.new_name as orderdetail></#list>
<#list ${Recipient.new_orderdetail.new_amount as orderdetail></#list>
<table>
<#list ${Recipient.new_orderdetail as orderdetail>
<tr>
<td>${orderdetail.new_name}</td>
<td>${orderdetail.new_amount}</td>
</tr>
</#list>
</table>”

So if I excluded one of the leading“<#list” commands like this one
“<#list ${Recipient.new_orderdetail.new_name as orderdetail>”
then I would get an error saying “Error: ‘new_orderdetail’ entity doesn’t contain attribute with Name = ‘new_name’.” Now you know how to make your template work.

This entry was posted in MS CRM and tagged , , . Bookmark the permalink.

One Response to Using ClickDimensions to create Emails, an exploratory testing adventure

  1. Pingback: Marketing in Dynamics CRM | CRM Rocks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s