{"id":4541,"date":"2024-01-29T16:46:19","date_gmt":"2024-01-29T16:46:19","guid":{"rendered":"https:\/\/himbap.com\/blog\/?p=4541"},"modified":"2024-01-29T16:46:19","modified_gmt":"2024-01-29T16:46:19","slug":"creating-email-template-for-custom-entities-in-dynamics-365-ce","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=4541","title":{"rendered":"Creating Email Template for Custom Entities in Dynamics 365 CE"},"content":{"rendered":"<p><strong>Introduction<\/strong>:<\/p>\n<p>In the dynamic landscape of modern business operations, effective communication stands as a cornerstone for achieving success. Within Dynamics 365 CE, various communication avenues are available to engage with customers through activities. While the platform offers several out-of-the-box options for sending notifications to customers, there are occasions when we must extend the capabilities of Dynamics 365 CE to meet specific requirements.<\/p>\n<p>Consider a scenario where the need arises to dispatch emails using templates for a custom entity. This email correspondence must originate from a designated Queue and be directed to unresolved email addresses. In this first post, we will discuss about sending emails to custom entities utilizing templates within Dynamics 365 CE.<\/p>\n<p><strong>Details<\/strong><br \/>\nEmail templates in Dynamics 365 CE are like pre-made layouts for emails that help businesses send messages to customers in a consistent and efficient way. With templates, companies can keep their brand style the same and make sure their messages are interesting to customers. While creating email template we have only few out of the box entities available directly, for other out of the box entities or custom entities we need to select Global option.<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4554 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email1-300x259.png\" alt=\"email1\" width=\"300\" height=\"259\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email1-300x259.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email1.png 523w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>While creating email template for the above available out of the box entities for example let&#8217;s say Account, we can easily use dynamic values options like below and use data field to design our template.<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4555 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email2-300x103.png\" alt=\"email2\" width=\"300\" height=\"103\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email2-300x103.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email2-1024x352.png 1024w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email2-624x215.png 624w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email2.png 1622w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>But we can&#8217;t use these options for our custom entities, while we are using Global template we can only add dynamic values from the User entities directly but this does not mean we can&#8217;t use dynamic values from our custom entity, yes we can do that \ud83d\ude42 using following options.<\/p>\n<p>Let&#8217;s take an example we want to use dynamic value for the primary field from our custom entity, we need to write is using following syntax<\/p>\n<p>{!entitylogicalname:fieldlogicalname;}<\/p>\n<p>so for example if we have a him_event entity and we want to use dynamic value for name field (him_name) we need to write it like below<\/p>\n<p>{!him_event:him_name;}<\/p>\n<p>Similarly let&#8217;s we have field for other data type like below<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email3.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4556 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email3-300x109.png\" alt=\"email3\" width=\"300\" height=\"109\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email3-300x109.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email3-1024x372.png 1024w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email3-624x227.png 624w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email3.png 1261w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In above screenshot we cost is currency field, event organizer is lookup field and event type is an option set. When we will save these change it should be changed like below<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email4.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4557 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email4-300x164.png\" alt=\"email4\" width=\"300\" height=\"164\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email4-300x164.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email4-624x342.png 624w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2024\/01\/email4.png 758w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>If it is not changing like above it means there is some issue in the syntax. Now let&#8217;s say we want to bring some non primary fields from the lookup entity, we don&#8217;t have any out of the box option available so in our next post we will discuss how we can bring non primary field to our email while using Global templates so stay tunned.<\/p>\n<p><strong>Summary<\/strong><br \/>\nToday&#8217;s we saw how we can use dynamic values for our custom entity in the global template.<\/p>\n<p>Hope it will help someone !!<br \/>\n<strong>Keep learning and Keep Sharing !!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: In the dynamic landscape of modern business operations, effective communication stands as a cornerstone for achieving success. Within Dynamics 365 CE, various communication avenues are available to engage with customers through activities. While the platform offers several out-of-the-box options for sending notifications to customers, there are occasions when we must extend the capabilities of Dynamics 365 CE to meet&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=4541\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[21,402],"tags":[1068,1070,1069],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4541"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4541"}],"version-history":[{"count":5,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4541\/revisions"}],"predecessor-version":[{"id":4561,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4541\/revisions\/4561"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}