This project has moved and is read-only. For the latest updates, please go here.

Getting started

Install the solution

This CRM extension is a simple Dynamics CRM solution which can be installed following the standard import process. (See MSDN). The solutions have been released as unmanaged, so you can customise them or covert them to managed if you want. In the Downloads section you will find basically two packages:
  1. DXTools Custom Emails: main solution with all functionality
  2. DXTools Custom Emails Sample: simple sample solution to show how to use the expected functionality

How to send a custom email?

Note: The next documentation is based on the solution sample DXTools Custom Emails Sample, which can be found in the Downloads section.
  1. Create a new custom template
  2. Send an email using your new custom template

1. Create a new custom template
Create a new Global Email Template. Out of the box, this template is not linked to any CRM entity, so that initially you can only used users dynamics attributes.

DXTools CRM Global Template.png

However, we are going to use a small trick to add dynamics attributes from our custom entity:


Exactly, basically we are going to mark the logical attribute name with curly brackets. Let's have a look at this example:

DXTools Payment Template Sample.jpg

In this example, we are assuming the custom entity Payment (dxtools_payment) will be our main entity. This way, {dxtools_paymentreference} is an attribute of the same that will be replaced dynamically based on the payment record given as an argument later on.

Template Attachments
As part of the template, it is a good practice to attach the files you will send with your emails later on.

DXTools Sample Payment Template Attachments.jpg

2. Send an email using your new custom template
You have a few options to send your custom email, choose the one better fits in your development.

a) Using our custom workflow activity "Create Custom Email"
The solution provides the custom workflow activity "Create Custom Email" which can be used from any CRM process (Workflow, Action, Dialog). See "New Payment Received" workflow in the sample solution.

DXTools Custom Workflow Activities.jpg

Create Custom Email workflow activity parameters:

DXTools Create Custom Email activity.png

  • Email Template Name: Name of the CRM email template to be used
  • Sender Email Address: Email address of the user or queue which is sending the email (From)
  • To Recipient Record URL: Record URL of the CRM record which is going to receive the email. It must be an CRM emailable entity.
  • Email Regarding Record URL: Record URL of the CRM record which is going to be set as the regarding object of the email. It must be an entity suitable for activities.
  • Record Context URL: Record URL of the CRM record which is going to be used to populate the values of the dynamics attributes of our custom template. This is considered the main entity type.
  • Attachments: file names separated by comma. They must be template attachments in CRM. Notice the benefit of this solution is that you could use attachments from different templates in the same email.
  • Allow Duplicate Attachments: Two or more different files with the same name could be in different templates. If you want to attach all of them, set this flag to True, otherwise set it to False. Using the second option, an exception will be thrown indicating the duplicate file and its templates. This can be useful to control unique version of attachments across different templates.
  • Only Use Attachments in Template: Two or more different files could be in different templates with the same file name. In this case, you may just want to use the one attached in your corresponding template,

b) Using our action "Send Custom Email"
The next action create and send a custom email using the custom workflow activity previously described. Its arguments are basically the same as the "Create Custom Email" workflow activity, with the benefit that it allows multiple recipients (EntityCollection):

DXTools Send Custom Email Action.png

Because it is an action, it can be triggered from different context using the CRM SDK Web Services (e.g. JavaScript, plugins, custom applications, etc). In the source code, you can find the corresponding request type which has been generated using crmsvcutil.exe.

DXTools Send Custom Email Action Request.jpg

Last edited Mar 21, 2014 at 3:08 AM by rtebar, version 51