How to send ClickDimensions emails with data from ANY record!

So now that we’ve looked at how to send ClickDimensions emails using Flow, our next step is to send an email containing data from any record in Dynamics! They said it couldn’t be done, but I’m here to prove them wrong! We’re going to be taking a look at this process and how to automate it using magic i.e – Microsoft Flow 💖

In today’s example, our scenario is going to be sending an email to a Contact any time they register for an event. The email will contain a list of events the Contact has registered for that are upcoming. We’re going to automate the entire process using Flow!

First things first, if you haven’t read my previous blog on the Relate Records action, be sure to create this flow within a solution. We will need this in order to access the Relate Records CDS action. Once you have that down, we’ll go ahead and create the trigger for our Flow. Because we’re going to be sending an email every time someone registers for an event, we’re going to use the “When a Record is Created” trigger:

If you only want this flow to run for specific events, you can add a condition in here. Otherwise move on to retrieving the Contact that registered for the event. We’re going to need data from that Contact record later on. We can retrieve the Contact from the Event Participation record that was just created as so:

Now we’re going to go and build out the Email Send. If you want more details on this, be sure to take a look at this blog post. Just remember to associate the correct template with the Email Send! This template should contain Freemarker that is going to reference the Event Participation entity. We are using the same Freemarker as in the original blog post.

Now the Email Send has been created, we’re going to associate the contact in line with my previous blog on Relating Records.

Now to the magic! We’re going to loop through all of the Contact’s Event Participation records and create connections for the ones that have a status of Registered. Use the List Records action:

The trick is getting this Fliter Query data correct. We want to list out all Event Participation records where the Contact value on the Event Participation record is equal to the current Contact we are working with. cdi_contactid is the logical name for the Contact field on the Event Participation record so to pull the value from that field on the records we’re comparing we add _value to the logical name of the field. To compare it with something we use the eq expression. We are able to use Dynamic Content to pull in the Contact value. It takes some practice to get right, so stick with it!

Next we’ll use the Apply to Each action to start looping through the list and checking to see if the record has a status of Registered:

If the list of records contains an Event Participation record with a status of Registered, we’ll want to create a connection record between that Event Participation Record and the Email Sent itself:

Pay attention to this order!

This action will create the Connection records to the Email Send. From here, once you update the Email Send record and sent the email, the Freemarker will pick up the records and list out the values as defined in your email!

Now that we’ve learned how to send a ClickDimensions Email with data from any record, the possibilities are endless! What are you going to use this Flow for? I’d love to hear your applications!

One thought on “How to send ClickDimensions emails with data from ANY record!

  1. Thank you so much, this has been so valuable for us!

    Each year we send emails out to roughly 350 office managers to let them know which of their employees have subscriptions expiring for our service. Traditionally this has been done manually, but of course that’s a fiddly and time consuming process for our CSRs. This year at the end of the month it’ll be entirely automatic, and based entirely on your advice here — it’s such a great step forward.

    We’re now looking at another area that would benefit from this, but a major stumbling block is the seeming inability to sort the records — alphabetically, for example:

    – It’s easy to sort the records in Power Automate, but when you iterate through them using FreeMarker they’ve become jumbled again.
    – FreeMarker has built-ins specifically for sorting (‘sort’ and ‘sort_by’), but they both seem to cause the email to fail. From ClickDimensions point of view it’s “sent” — but it never arrives.

    Do you have any thoughts on what we might be able to try?


Leave a Reply

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

You are commenting using your 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

This site uses Akismet to reduce spam. Learn how your comment data is processed.