{"id":1501,"date":"2015-07-27T16:01:12","date_gmt":"2015-07-27T10:31:12","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=1501"},"modified":"2015-07-27T16:01:12","modified_gmt":"2015-07-27T10:31:12","slug":"adding-signature-to-emails-in-dynamics-crm","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2015\/07\/adding-signature-to-emails-in-dynamics-crm\/","title":{"rendered":"Adding Signature to Emails in Dynamics CRM"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p style=\"text-align: justify;\">Signatures are very integral part of any emails that are exchanged in present times. Dynamics CRM however does not yet have an OOB way to configure a signature for a user so that when a new Email is created, the signature is automatically added to the email body.<\/p>\n<p style=\"text-align: justify;\">There is always the Insert Template button that can be used to add a template. You could create templates of your signature. But this requires that the user click on the Insert Template to get the template added to the email body.<\/p>\n<p style=\"text-align: justify;\">Here is an alternate way of doing the same without requiring the users to click on the Insert Template button.<\/p>\n<h2 style=\"text-align: justify;\">Walkthrough<\/h2>\n<p style=\"text-align: justify;\">We would need to create the following two components<\/p>\n<ul style=\"text-align: justify;\">\n<li>Global Email Template &#8211; This would be used to store the signature format.<\/li>\n<li>Script Web Resource to read and to insert global email template to email body<\/li>\n<\/ul>\n<ul style=\"text-align: justify;\">\n<li><strong>Global email template:<\/strong><\/li>\n<\/ul>\n<p style=\"text-align: justify;\">Create a Global email template to store the signature format of CRM User. Since it\u2019s a global template we can add user details in the body of template.<\/p>\n<p style=\"text-align: justify;\">In this template we have added user\u2019s<strong> Full Name <\/strong>and<strong> Position.<\/strong><\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2015\/07\/signature.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1502\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2015\/07\/signature.png\" alt=\"signature\" width=\"651\" height=\"371\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">Whenever we instantiate this template the Full Name and Positions will get populated from logged-in user.<\/p>\n<ul style=\"text-align: justify;\">\n<li><strong>Script Web Resource to read and to modify global email template:<\/strong><\/li>\n<\/ul>\n<p style=\"text-align: justify;\">Create Web Resource of type script, in code retrieve above template and instantiate it.<\/p>\n<p style=\"text-align: justify;\">After reading the template, call the InstantiateTemplate method and get the description (Signature of user) and set it on the email description.<\/p>\n<p style=\"text-align: justify;\">Call function on load of email entity that will do below task,<\/p>\n<p style=\"text-align: justify;\"><strong>\u00a0Get logged-in User id:<\/strong><\/p>\n<p style=\"text-align: justify;\">var userId = Xrm.Page.context.getUserId();<\/p>\n<p style=\"text-align: justify;\"><strong>Execute Soap<\/strong> <strong>InstantiateTemplateRequest<\/strong>:<\/p>\n<p>var Soapreq = &#8220;&lt;request i:type=&#8217;b:InstantiateTemplateRequest&#8217; xmlns:a=&#8217;http:\/\/schemas.microsoft.com\/xrm\/2011\/Contracts&#8217; xmlns:b=&#8217;http:\/\/schemas.microsoft.com\/crm\/2011\/Contracts&#8217;&gt;&#8221; +<\/p>\n<p>&#8220;&lt;a:Parameters xmlns:c=&#8217;http:\/\/schemas.datacontract.org\/2004\/07\/System.Collections.Generic&#8217;&gt;&#8221; +<\/p>\n<p>&#8220;&lt;a:KeyValuePairOfstringanyType&gt;&#8221; +<\/p>\n<p>&#8220;&lt;c:key&gt;TemplateId&lt;\/c:key&gt;&#8221; +<\/p>\n<p>&#8220;&lt;c:value i:type=&#8217;d:guid&#8217; xmlns:d=&#8217;http:\/\/schemas.microsoft.com\/2003\/10\/Serialization\/&#8217;&gt;&#8221; + TemplateID + &#8220;&lt;\/c:value&gt;&#8221; +<\/p>\n<p>&#8220;&lt;\/a:KeyValuePairOfstringanyType&gt;&#8221; +<\/p>\n<p>&#8220;&lt;a:KeyValuePairOfstringanyType&gt;&#8221; +<\/p>\n<p>&#8220;&lt;c:key&gt;ObjectType&lt;\/c:key&gt;&#8221; +<\/p>\n<p>&#8220;&lt;c:value i:type=&#8217;d:string&#8217; xmlns:d=&#8217;http:\/\/www.w3.org\/2001\/XMLSchema&#8217;&gt;systemuser&lt;\/c:value&gt;&#8221; +<\/p>\n<p>&#8220;&lt;\/a:KeyValuePairOfstringanyType&gt;&#8221; +<\/p>\n<p>&#8220;&lt;a:KeyValuePairOfstringanyType&gt;&#8221; +<\/p>\n<p>&#8220;&lt;c:key&gt;ObjectId&lt;\/c:key&gt;&#8221; +<\/p>\n<p>&#8220;&lt;c:value i:type=&#8217;d:guid&#8217; xmlns:d=&#8217;http:\/\/schemas.microsoft.com\/2003\/10\/Serialization\/&#8217;&gt;&#8221;+userId+&#8221;&lt;\/c:value&gt;&#8221; +<\/p>\n<p>&#8220;&lt;\/a:KeyValuePairOfstringanyType&gt;&#8221; +<\/p>\n<p>&#8220;&lt;\/a:Parameters&gt;&#8221; +<\/p>\n<p>&#8220;&lt;a:RequestId i:nil=&#8217;true&#8217; \/&gt;&#8221; +<\/p>\n<p>&#8220;&lt;a:RequestName&gt;InstantiateTemplate&lt;\/a:RequestName&gt;&#8221; +<\/p>\n<p>&#8220;&lt;\/request&gt;&#8221;;<\/p>\n<p>var result = XrmServiceToolkit.Soap.Execute(Soapreq);<\/p>\n<p style=\"text-align: justify;\"><strong>Get the description (content of email template) from result and set it as the description (body) of email: <\/strong><\/p>\n<p style=\"text-align: justify;\">We get the subject and description field in result when we execute <strong>InstantiateTemplateRequest<\/strong> request.<\/p>\n<p style=\"text-align: justify;\">Get the description field where we get the signature of user and set it to \u2018description\u2019 field of email.<\/p>\n<p style=\"text-align: justify;\">\u00a0\u00a0\u00a0\u00a0\u00a0 Xrm.Page.getAttribute(&#8216;description&#8217;).setValue(description);<\/p>\n<p style=\"text-align: justify;\">This way when we open an email activity the signature will be added with logged in user name.<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2015\/07\/signature11.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1504\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2015\/07\/signature11.png\" alt=\"signature1\" width=\"788\" height=\"325\" \/><\/a><\/p>\n<h2 style=\"text-align: justify;\">Conclusion:<\/h2>\n<p style=\"text-align: justify;\">Not a perfect but certainly a workaround to get the signature working with minimal code.<\/p>\n<p>Stuck with migration to Dynamics CRM? Experts at <a href=\"http:\/\/inogic.com\" target=\"_blank\" rel=\"noopener noreferrer\">Inogic<\/a> are always happy to help you, get in touch with us on <a href=\"mailto:crm@inogic.com\">crm@inogic.com<\/a>.<\/p>\n<p>Keywords : Dynamics CRM, CRM 2015, CRM 2015,\u00a0Adding Signature to Emails, CRM 2011, Microsoft Dynamics CRM<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Signatures are very integral part of any emails that are exchanged in present times. Dynamics CRM however does not yet have an OOB way to configure a signature for a user so that when a new Email is created, the signature is automatically added to the email body. There is always the Insert Template\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2015\/07\/adding-signature-to-emails-in-dynamics-crm\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[19,21,22,24],"tags":[107,592],"class_list":["post-1501","post","type-post","status-publish","format-standard","hentry","category-dynamics-crm","category-dynamics-crm-2013","category-dynamics-crm-2015","category-dynamics-crm-2016","tag-adding-signature-to-emails","tag-dynamics-crm"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/1501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=1501"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/1501\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=1501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=1501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=1501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}