{"id":568,"date":"2020-08-14T13:00:27","date_gmt":"2020-08-14T13:00:27","guid":{"rendered":"http:\/\/stirna.is\/?p=568"},"modified":"2020-08-14T13:00:27","modified_gmt":"2020-08-14T13:00:27","slug":"sending-html-emails-through-dynamics-365","status":"publish","type":"post","link":"https:\/\/stirna.is\/?p=568","title":{"rendered":"Sending HTML emails through Dynamics 365"},"content":{"rendered":"\n<p class=\"has-small-font-size wp-block-paragraph\">Task: Send HTML email though Dynamics 365<br>Difficulty: Advanced<br>Time to implement: 1-2 hours<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-rich wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Sending HTML emails through Dynamics 365 Sales\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/M6SPHelSRW4?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><figcaption>Check out this video<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Tracking emails is a popular feature in Dynamics 365 Customer Engagement. You can track emails by <a rel=\"noreferrer noopener\" href=\"https:\/\/docs.microsoft.com\/en-us\/power-platform\/admin\/connect-exchange-online\" target=\"_blank\">connecting your mailbox with Microsoft Exchange<\/a> and either use the <a rel=\"noreferrer noopener\" href=\"https:\/\/docs.microsoft.com\/en-us\/dynamics365\/outlook-addin\/user-guide\/overview-tracking-records\" target=\"_blank\">Dynamics 365 app for Outlook<\/a> or <a rel=\"noreferrer noopener\" href=\"https:\/\/docs.microsoft.com\/en-us\/dynamics365\/sales-enterprise\/enhanced-email\" target=\"_blank\">Dynamics 365 email capabilities<\/a> 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"623\" height=\"452\" src=\"http:\/\/34.74.14.69\/wp-content\/uploads\/2020\/08\/enhanced-email-pop-up.png?w=623\" alt=\"\" class=\"wp-image-573\" srcset=\"https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/enhanced-email-pop-up.png 623w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/enhanced-email-pop-up-300x218.png 300w\" sizes=\"auto, (max-width: 623px) 100vw, 623px\" \/><figcaption>Email editing experience in Dynamics 365<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.  <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. Create the flow<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>You start by navigating to <a rel=\"noreferrer noopener\" href=\"http:\/\/make.powerapps.com\" target=\"_blank\">make.powerapps.com<\/a> and create a solution for your Flow. For information on how to create a solution in Power Apps please refer to <a rel=\"noreferrer noopener\" href=\"https:\/\/docs.microsoft.com\/en-us\/powerapps\/maker\/common-data-service\/create-solution\" target=\"_blank\">this article<\/a>. <\/li><li>Click on the &#8216;+New&#8217; button and select Flow<br><\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1272\" height=\"496\" src=\"http:\/\/34.74.14.69\/wp-content\/uploads\/2020\/08\/image.png?w=1024\" alt=\"Create a Flow from within a Power App solution\" class=\"wp-image-578\" srcset=\"https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image.png 1272w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-300x117.png 300w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-1024x399.png 1024w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-768x299.png 768w\" sizes=\"auto, (max-width: 1272px) 100vw, 1272px\" \/><figcaption>Create a Flow from within a Power App solution<\/figcaption><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\"><li>Search for and select the Dataflex &#8216;When a record is created, updated or deleted&#8217; trigger (Common Data Service current).<\/li><li>Give your Flow a name.<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">2. Configure the flow<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>In trigger condition choose Update.<\/li><li>In the entity name choose Leads.<\/li><li>For the Scope select Organization.<\/li><li>In the filtering attribute write the name of your custom field. <\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1198\" height=\"398\" src=\"http:\/\/34.74.14.69\/wp-content\/uploads\/2020\/08\/image-2.png?w=1024\" alt=\"Dataflex 'When a record is created, updated or deleted' trigger (Common Data Service current)\" class=\"wp-image-582\" srcset=\"https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-2.png 1198w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-2-300x100.png 300w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-2-1024x340.png 1024w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-2-768x255.png 768w\" sizes=\"auto, (max-width: 1198px) 100vw, 1198px\" \/><figcaption>The When a record is created, updated or deleted trigger (CDS current)<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Next we need a variable to store our HTML. To do this we:<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"5\"><li>Click on the &#8216;New Step&#8217; button.<\/li><li>Select Initialize variable.<\/li><li>Give our variable a name and choose type string. Leave the value field empty.<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1206\" height=\"346\" src=\"http:\/\/34.74.14.69\/wp-content\/uploads\/2020\/08\/image-3.png?w=1024\" alt=\"Power Automate Initialize variable\" class=\"wp-image-583\" srcset=\"https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-3.png 1206w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-3-300x86.png 300w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-3-1024x294.png 1024w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-3-768x220.png 768w\" sizes=\"auto, (max-width: 1206px) 100vw, 1206px\" \/><figcaption>Initialize variable<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Before we set the variable you first want to check if our field value meets the condition.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"8\"><li>Click on the &#8216;New Step&#8217; button.<\/li><li>Select control.<\/li><li>Choose control condition.<\/li><li>For the condition choose the custom field and that it should be equal to &#8216;true&#8217;. The field is a two option field which can be either true (1) or false (0).<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1206\" height=\"368\" src=\"http:\/\/34.74.14.69\/wp-content\/uploads\/2020\/08\/image-4.png?w=1024\" alt=\"\" class=\"wp-image-585\" srcset=\"https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-4.png 1206w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-4-300x92.png 300w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-4-1024x312.png 1024w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-4-768x234.png 768w\" sizes=\"auto, (max-width: 1206px) 100vw, 1206px\" \/><figcaption>The condition should be that send invitation value is true.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"12\"><li>In the \u2018If yes\u2019 box click \u2018Add an action\u2019.<\/li><li>Choose Set variable.<\/li><li>In the name select the variable you initialized in steps 2.6-2.7.<\/li><li>In the value field paste in your HTML code.<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1272\" height=\"488\" src=\"http:\/\/34.74.14.69\/wp-content\/uploads\/2020\/08\/image-5.png?w=1024\" alt=\"\" class=\"wp-image-588\" srcset=\"https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-5.png 1272w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-5-300x115.png 300w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-5-1024x393.png 1024w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-5-768x295.png 768w\" sizes=\"auto, (max-width: 1272px) 100vw, 1272px\" \/><figcaption>Set variable and have it store the HTML code<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now you have created the condition and set the variable. This leads to the creation of the email message. To create the message you:<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"16\"><li>Below the \u2018Set email content\u2019 action click \u2018Add an action\u2019.<\/li><li>Choose Create a new record &#8211; Dataflex (Common Data Service current).<\/li><li>For the email message choose the sender and receiver of the message. You must refer to the entity&#8217;s path as shown in the following screenshot. For more info about how this connector&#8217;s attributes are referenced see <a rel=\"noreferrer noopener\" href=\"https:\/\/powerusers.microsoft.com\/t5\/Power-Automate-Community-Blog\/Resource-not-found-for-the-segment-issue-in-Power-Automate\/ba-p\/552837\" target=\"_blank\">this article<\/a>.<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1210\" height=\"932\" src=\"http:\/\/34.74.14.69\/wp-content\/uploads\/2020\/08\/image-8.png?w=1024\" alt=\"How lookup fields are referenced in the create a new record current action\" class=\"wp-image-595\" srcset=\"https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-8.png 1210w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-8-300x231.png 300w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-8-1024x789.png 1024w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-8-768x592.png 768w\" sizes=\"auto, (max-width: 1210px) 100vw, 1210px\" \/><figcaption>How lookup fields are referenced in the create a new record current action<\/figcaption><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"19\"><li>Click &#8216;Show advanced options&#8217; and add the email body to the &#8216;Description&#8217; field, owner in the &#8216;Owner (Owners)&#8217; field, the lead (&#8216;\/leads\/{the lead GUID value}&#8217;) in the &#8216;Regarding (Leads)&#8217; field, and the subject in the &#8216;Subject&#8217; field.<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">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 <a rel=\"noreferrer noopener\" href=\"https:\/\/d365demystified.com\/2020\/05\/04\/call-a-dynamics-365-action-from-flow-bound-and-unbound-actions-power-automate\/\" target=\"_blank\">this article<\/a>.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"20\" id=\"block-d483af26-b22b-4722-a915-9525dc2ec812\"><li>Below the \u2018Create a new record\u2019 action click \u2018Add an action\u2019.<\/li><li>Choose Perform a bound action &#8211; Dataflex (Common Data Service current).<\/li><li>In the Entity name choose Email Messages<\/li><li>For the Action Name choose SendEmail.<\/li><li>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.<\/li><li>In the IssueSend select Yes. <\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1238\" height=\"1056\" src=\"http:\/\/34.74.14.69\/wp-content\/uploads\/2020\/08\/image-9.png?w=1024\" alt=\"Perform a bound action - Dataflex (CDS current) trigger\" class=\"wp-image-598\" srcset=\"https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-9.png 1238w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-9-300x256.png 300w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-9-1024x873.png 1024w, https:\/\/stirna.is\/wp-content\/uploads\/2020\/08\/image-9-768x655.png 768w\" sizes=\"auto, (max-width: 1238px) 100vw, 1238px\" \/><figcaption>Perform a bound action &#8211; Dataflex (CDS current) trigger<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">3. Test the flow<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">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\u2019s video above.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Task: Send HTML email though Dynamics 365Difficulty: AdvancedTime to implement: 1-2 hours 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":604,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[13,14,21],"class_list":["post-568","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dynamics-365","tag-dynamics-365-sales","tag-dynamics-crm","tag-power-automate"],"_links":{"self":[{"href":"https:\/\/stirna.is\/index.php?rest_route=\/wp\/v2\/posts\/568","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stirna.is\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stirna.is\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stirna.is\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/stirna.is\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=568"}],"version-history":[{"count":0,"href":"https:\/\/stirna.is\/index.php?rest_route=\/wp\/v2\/posts\/568\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/stirna.is\/index.php?rest_route=\/wp\/v2\/media\/604"}],"wp:attachment":[{"href":"https:\/\/stirna.is\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=568"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stirna.is\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=568"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stirna.is\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=568"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}