Categories
Dynamics 365

Sending HTML emails through Dynamics 365

Task: Send HTML email though Dynamics 365
Difficulty: Advanced
Time to implement: 1-2 hours

Check out this video

Tracking emails is a popular feature in Dynamics 365 Customer Engagement. You can track emails by connecting your mailbox with Microsoft Exchange and either use the Dynamics 365 app for Outlook or Dynamics 365 email capabilities to send out emails. Companies see great value in this feature because it allows them to have a CRM system in place where relevant interactions between a customer and an organization can be observed.

In this post, I am going to show you how to use the Dynamics 365 emails and discuss some of its benefits and limitations in terms of functionality. Dynamics 365 emails are equipped with a simple email editor for creating emails. The editor covers the basic requirements for what you would normally use when sending an email from your email client such as Gmail or Outlook.

Email editing experience in Dynamics 365

Dynamics 365 emails allow you to send emails to multiple recipients, add attachments, insert links and images. However, if you want to create your own HTML email you cannot do that through Dynamics 365 emails. This could be useful in scenarios where the company wants to send out a promotional emails, e.g. because there is a new product release or an event. Dynamics 365 does not support HTML emails.

On the other hand, if you like to send HTML emails through Dynamics 365 there is a workaround. By leveraging Power Automate and the Dataflex (CDS Current enviornment) connector, you can create a workflow that creates and sends an email with HTML content.

For example, you have a lead that you would like to send an event invite to. You can achieve this by creating a flow in Power Automate and use a field on the lead to trigger the flow. The salesperson could simply check a box on the lead form to send the invitation. Furthermore, the email would be automatically tracked in Dynamics 365. This gives the salesperson and her manager a better overview of who has received an invitation to an event.

In the remainder of this post I will show how you can create and send a HTML email through Dynamics 365 Sales with the help of Power Automate.

1. Create the flow

  1. You start by navigating to make.powerapps.com and create a solution for your Flow. For information on how to create a solution in Power Apps please refer to this article.
  2. Click on the ‘+New’ button and select Flow
Create a Flow from within a Power App solution
Create a Flow from within a Power App solution
  1. Search for and select the Dataflex ‘When a record is created, updated or deleted’ trigger (Common Data Service current).
  2. Give your Flow a name.

2. Configure the flow

Once you have created the flow you can define the entity name, the type of trigger condition as well as the filtering attribute for the newly created trigger. In this case we have created a custom field which will serve as the trigger for this flow or the filtering attribute.

  1. In trigger condition choose Update.
  2. In the entity name choose Leads.
  3. For the Scope select Organization.
  4. In the filtering attribute write the name of your custom field.
Dataflex 'When a record is created, updated or deleted' trigger (Common Data Service current)
The When a record is created, updated or deleted trigger (CDS current)

Next we need a variable to store our HTML. To do this we:

  1. Click on the ‘New Step’ button.
  2. Select Initialize variable.
  3. Give our variable a name and choose type string. Leave the value field empty.
Power Automate Initialize variable
Initialize variable

Before we set the variable you first want to check if our field value meets the condition.

  1. Click on the ‘New Step’ button.
  2. Select control.
  3. Choose control condition.
  4. For the condition choose the custom field and that it should be equal to ‘true’. The field is a two option field which can be either true (1) or false (0).
The condition should be that send invitation value is true.

When the condition is true you want the email to be sent. First you need to set the variable we created in our previous step and then you will create the email. Lastly you want to send the email message using a bound action.

  1. In the ‘If yes’ box click ‘Add an action’.
  2. Choose Set variable.
  3. In the name select the variable you initialized in steps 2.6-2.7.
  4. In the value field paste in your HTML code.
Set variable and have it store the HTML code

Now you have created the condition and set the variable. This leads to the creation of the email message. To create the message you:

  1. Below the ‘Set email content’ action click ‘Add an action’.
  2. Choose Create a new record – Dataflex (Common Data Service current).
  3. For the email message choose the sender and receiver of the message. You must refer to the entity’s path as shown in the following screenshot. For more info about how this connector’s attributes are referenced see this article.
How lookup fields are referenced in the create a new record current action
How lookup fields are referenced in the create a new record current action
  1. Click ‘Show advanced options’ and add the email body to the ‘Description’ field, owner in the ‘Owner (Owners)’ field, the lead (‘/leads/{the lead GUID value}’) in the ‘Regarding (Leads)’ field, and the subject in the ‘Subject’ field.

The final step is to send the email. This requires a special kind of action called a bound action. To see the difference between bound and unbound actions please refer to this article.

  1. Below the ‘Create a new record’ action click ‘Add an action’.
  2. Choose Perform a bound action – Dataflex (Common Data Service current).
  3. In the Entity name choose Email Messages
  4. For the Action Name choose SendEmail.
  5. In the Item ID insert the Email Message ID. You find the ID by using the dynamics content and choosing the unique ID of the email message you created in steps 2.16-2.19 above.
  6. In the IssueSend select Yes.
Perform a bound action - Dataflex (CDS current) trigger
Perform a bound action – Dataflex (CDS current) trigger

3. Test the flow

You can now test your flow to see if everything works as it should. Do a test run on a lead in your Dynamics 365 Sales to verify that the flow runs when the custom field is changed on the lead and if the email is sent when the flow condition is true. For more information about performing the test, please refer to the blog post’s video above.

Categories
Dynamics 365

Follow your recipient’s activity in Dynamics 365

Tasks: Send a notification when a contact opens a Dynamics 365 attachment
Difficulty: Intermediate
Time to implement: 1-2 hours

In this post I’ll show you how you can use the Email Engagement solution, which I showed you how to configure in my previous post, to automatically sending a notification when a contact/recipient has opened a Dynamics 365 email attachment.

Tools

  • Dynamics 365 Sales: A popular CRM system from Microsoft that allows you to track your sales pipeline and activities, opportunities, and leads.
  • Email Engagement: One of Sales Insights’ solutions that enables you to follow emails in Dynamics 365 Sales. See my post Tracking opens and clicks of Dynamics 365 emails to see how it is enabled.
  • Power Automate: A service from Microsoft that allows you to connect different systems and create automated processes. In this example it is used to create a task and send a notification to the owner of a Dynamics 365 email message when an attachment is opened. In this post premium connectors are used that require a premium license for Power Automate.

Email Engagement follow up options

Email Engagement allows you to follow emails you send from Dynamics 365. It also gives you an option to set reminders to follow up on emails. The available options are:

  • If I do not receive a reply by
  • If the email is not opened by
  • Remind me anyway at
Set reminder options

The reasoning behind these options is that a salesperson wants to be able to follow up if there is no recipient activity. Another use case is when there is a recipient activity, the salesperson might want to follow up. E.g. when an email attachment containing a quote or a pricing is opened. The purpose of this exercise is to expand the current options to enable notification when a contact/recipient opens an attachment that is tracked via Email Engagement. To this end we will leverage Power Automate to send the notification.

A prerequisite to perform the work in this exercise is that you have already enabled Email Engagement in your Sales Insights settings, OneDrive integration in Dynamics 365, and that you have the appropriate licenses and permissions, of course.

Create and configure a flow

You start by navigating to flow.microsoft.com, create a flow from blank and choose the ‘When a record is updated’ trigger. This will open up the flow designer. To configure the flow you:

  1. Choose current environment in Environment.
  2. Choose Email messages in Entity name.
  3. Choose Organization in Scope.
  4. Under advanced options choose attachmentopencount. This lets the Flow know which fields on the email record you would like to monitor. In this case you want to monitor changes to the Attachment open count.

Next you insert a condition that checks if the number of opens your attachment has received is more than zero and that a category does not contain a specific value (we will come back to this later).

  1. Click on the ‘New step’ button.
  2. Select Condition.
  3. In the first condition insert Attachment open count equal to or greater than 1.
  4. In the second condition insert Category does not contain ‘Notification sent’.
When a record is updated trigger and the condition

When the condition is true you want the email notification to be sent. First you need to get the user information and then you will send the notification. Lastly you want to update the email message to ensure that the user doesn’t receive more than one notification.

  1. In the ‘If yes’ box click ‘Add an action’.
  2. Choose Get record (CDS).
  3. Choose current environment in Environment.
  4. Choose Users in Entity name.
  5. Put in the Owner of the email message as the Item identifier.
  6. Below the Get record action, click ‘Add an action’.
  7. Choose Send an email notification (V3). You might have to authenticate or accept to continue.
  8. In the To field insert the Primary Email from the user record.
  9. Fill in the subject and body of the email. You can use Dynamic content here which is recommended so the user knows which email/contact you are referring to.
Get record and Send an email notification (V3) actions
  1. Below the Send an email notification (V3) action, click ‘Add an action’.
  2. Choose Update a record (CDS).
  3. Choose current environment in Environment.
  4. Choose Email Messages in Entity name.
  5. In the record identifier put in the Email Message ID.
  6. Click ’Show advanced options’ and type in ‘Notification sent’. This is necessary to indicate somewhere on the record that a notification has been sent to the user. You can use any field. In this case I am using an OOB field called Category. If you are using Category for something else you may consider creating a custom field to store this value.
  7. Click Save to save your flow.
Update the Email Message

Testing the flow

You can now test your flow to see if everything works as it should. Do a couple of test runs on the same email message to verify that only one notification email is sent when an attachment is opened multiple times (note that the email must be sent through Dynamics 365 with a followed attachment). For more information about performing the tests, please refer to the blog post’s video above.

Categories
Dynamics 365

Tracking opens and clicks of Dynamics 365 emails

Task: Enable and configure Email Engagement to follow emails
Difficulty: Medium
Time to implement: 1-2 hours

In this post I am going to show you how you can follow emails in Dynamics 365 Sales. This is a very useful feature that is part of Sales Insights (free) solutions.

Watch the video

Tools used

  • Dynamics 365 Sales: A popular CRM system from Microsoft that allows you to track your sales pipeline and activities, opportunities, and leads.
  • Sales Insights: Free solutions that come with your Dynamics 365 Sales subscription.
  • Email Engagement: One of Sales Insights’ solutions that allows you to follow emails in Dynamics 365 Sales.

Enable Sales Insights

First I’ll show you how to enable Sales Insights:

  1. Navigate to Sales Hub.
  2. In the switch area choose Sales Insights settings.
  3. Click on the Accept Terms button.

Enable Email Engagement

Once you have enabled Sales Insights, you can enable the Email Engagement solution.

  1. Navigate to Sales Hub.
  2. In the switch area choose Sales Insights settings.
  3. Click on the Grant permissions button. Once you have granted the permissions this button changes to Set up.
Email engagement
Grant permission for Email engagement
  1. Click on the Set up button
  2. Switch on the Enable email engagement. Now you have set up the Email Engagement.

Create and send an email message

To test the solution you need to send a test email. You can send it to yourself. You do this by:

  1. Navigating to a contact record in Dynamics 365 and creating an email message on the contacts timeline. Try adding a link to the email message.
  2. Send the email message and once it has been sent, open it and click the link (you have to have sent to yourself to do that).

View the opens

To view the opens you have two options. Either view it directly from the contact’s timeline or from the All Followed Emails view on the Activities page.

To view it from the contact record:

  1. Navigate to the contact you sent to. You can see in the Timeline that the email has been sent and that it has been opened (if you followed step 3 in the previous section).
follow email results
Viewing the opens from the contact’s timeline

To view it from the Activities page:

  1. Navigate to the Activities page.
  2. Select the All Followed Email view. You can see four metrics that belong to the Email Engagement solution, Open count, Attachment open count, Links clicked count, and Reply count.

Author’s comments

I used a template in my testing and it appears that links inserted into a template for reuse are not tracked by the Email Engagement solution. Therefore, it is recommended to always manually inserting a link even when using an email template. This is something that Microsoft should consider improving on their side.

References

https://docs.microsoft.com/en-us/dynamics365/ai/sales/email-engagement

Categories
Dynamics 365 Forms Pro

Customer survey sent after purchase part 3/3: Configure a flow

Task: Automatically send customer survey after an opportunity is won
Difficulty: Medium
Time to implement: 1-2 hours

Content

  1. Creating the survey
  2. Configuring the email template
  3. Configure a flow

In this article we will conclude this blog series by configuring a flow for our survey in Power Automate.

Categories
Dynamics 365 Forms Pro

Customer survey sent after purchase part 2/3: Create an email template

Task: Automatically send customer survey after an opportunity is won
Difficulty: Medium
Time to implement: 1-2 hours

Content

  1. Creating the survey
  2. Configuring the email template
  3. Integration

In this article we will continue working in Forms Pro and build an email template with dynamic content from Dynamics 365.

Categories
Dynamics 365 Forms Pro

Customer survey sent after purchase part 1/3: Create the survey

Task: Automatically send customer survey after an opportunity is won
Difficulty: Medium
Time to implement: 1-2 hours

Content

  1. Creating the survey
  2. Configuring the email template
  3. Integration

In this three-part blog series we’ll be looking at a scenario which I have implemented for a client where a car dealership selling a new car sends a survey post-purchase to a customer and asks about his experience with the purchase and how likely he will recommend the company to his friends.

Categories
Dynamics 365 Microsoft Forms

Lead generation with webforms part 3/3: Connecting with Dynamics 365

Task: Create a lead in Microsoft Dynamics 365 Sales from a web form submission
Difficulty: Easy
Total time to implement: 1-2 hours

Content

  1. Creating the form (read post)
  2. Embedding the form on a webpage (read post)
  3. Connecting the form with Dynamics 365
    1. Creating a flow
    2. Configuring the flow
    3. Testing the flow

In this last part of my three-part blog series, I’ll show how you can leverage a Microsoft Power Automate flow to automate the task of creating a lead record from a form submission. While in previous posts we have already created a web form, published it and embedded on a webpage, in this post we will create a flow that will create a lead record in Dynamics 365 Sales and send a couple of emails.

Categories
Dynamics 365 Microsoft Forms

Lead generation with webforms part 1/3: Creating the form

Task: Create a lead in Microsoft Dynamics 365 Sales from a web form submission
Difficulty: Easy
Total time to implement: 1-2 hours

Content

  1. Creating the form
    1. The tools
    2. Creating the web form
  2. Embedding the form on a webpage (read post)
  3. Connecting the form with Dynamics 365 (read post)

In this three-part blog series, I’ll show how you, as a Dynamics 365 user, can leverage a set of tools that are part of your arsenal to automate a common task performed by marketing and sales professionals: creating a lead record from a form submission. In this first post we start by creating a web form that will be placed on our website and used to generate our leads.