Have you tried to make an email template, for custom entities or with attributes that are not the main ones that Dynamics CRM shows you out of the box? If the answer is yes, then you will have found a problem to complete that goal. Then I will explain in detail what the situation is and how we have managed to solve it.


For one of our customers, we have found the difficult task of generating some email templates in which we had to notify the customer that they had too much debt in the payment of the services. That is, through a process of segmentation of the base, applying filters send a predefined template informing the situation to regularize it.

Why would they say that this task is challenging to model in our Microsoft Dynamics CRM Services Platform if it only consists of taking emails from the data they already gave us? As it turns out of the box, CRM only allows us to create templates for some entities (native, distinct) and although we decided to create an entity of the “global type”, the fields that we can map to the mail are minimal. It is not entirely clear why Microsoft has put this limitation on something so basic, but we have managed to solve it anyway.

If you navigate to Settings / Templates / Email Templates, you can verify what I mention. Just look for custom entities, and display the list of fields that allows us to incorporate.

So, seeing this, I decided to look for a solution. Although I have found that solution mapping fields and values is using a particular syntax, I have found that it is quite complicated and even impossible if you need to search the content of an area of the lookup type. Not to mention if this field is within another lookup. That is a relationship from another relationship.

Example of syntax to enter the body of the email:

“Hello {!new_entity:new_lookupfield/@fieldname;}


Not having been very happy, I started searching the internet for more information, and I found a new solution called “DXTools Custom Email”.

This solution can be downloaded from here:

Although it doesn't explain much how to use it, and I had to investigate, I found it very powerful. This solution will allow us to use the global templates of the system and the attributes can be mapped quickly and, using syntax similar to the management of objects programmatically speaking:

  • Attribute:
  • Attributes within lookups: .
  • Attributes within lookups and again within lookups: . .
  • Attribute within the lookup within lookups within lookups. Etc.

To do this, you have to create a process (workflow) that calls the mail creation action called: “DXTools: CreateCustomEmail”

And complete some attributes like:

  • Email template name
  • Sender email address
  • To recipient record url
  • Email regarding record url
  • Record context url
  • Attachments
  • Allow duplicate attachments
  • Only use attachments in template
  • Static parameters
  • Send instantly
  • Issue send
  • Tracking token

Among other things that you ask us for, we have: the name of the template, Issuer Mail, Recipient URL (to associate the mail activity with it), URL of the "Referendum A" and URL of the entity on which the context of the variables declared in the template.

Want to see what the result is? Look...

"Dear {new_customer},

We send attached the summary of unpaid invoices to the date and the detail that composes it. They can also be viewed within our website.

The balance due to date is $ {ToString (new_field1: new_field2, ‘0.00’)}. ”

Once the email has been sent to the customer and replacing the dynamic values with the real ones of the linked record, it will result in the following:

Dear John Lennon,

We send attached the summary of unpaid invoices to the date and the detail that composes it. They can also be viewed within our website.

The balance due to date is $ 650.45.

Wow, our possibilities are endless!

…Or maybe not! Since here, I have encountered a critical problem, and I cannot associate more than one recipient to the email! I have tried to do that by manually updating the email, and I have not had good results. Nor when adding a second URL in the attribute called: "To Recipient Record URL". Everything seems not to work.

For this reason, I have decided to get to work and take advantage of the fact that this project is open source to personalize it a bit. I have modified the code a bit to make it more flexible in that regard.

The change itself is something simple: instead of being limited by a single record, if we define each one with a semicolon ";" now it will allow us to send our message to two recipients.

Sender email address

Single line of text

{PrincipalEmail(Entity(Systemuser)) }

To recipient record url

Single line of text

{Customer(Account) };{RecordUrl(Dynamic)(CustomField(Account) }

Email regarding record url

Single line of text

{RecordUrl(Dynamic)(CustomField) }

If we now check again in the generated email, in the "Recipient" field, we will have the two email addresses to which we want to send the email.

Through this customization, we will be ready to solve the situation. Those who wish to implement it may ask me to attach the zip with the solution to import with the registration tools plugin to include in their organization, the necessary plugins to optimize the solution.

As soon as I have a little more time, I will be customizing it to add the possibility of including copies of the mail to “CC” and “CCO”, to extend a version 2 of the functionality. Many people have already asked me to include it!!

I hope that this solution will serve many of you since I have been part of my week discovering how to solve something that at first seemed very simple to me, and it turns out that our friend Dynamics CRM has complicated us.