Microsoft Dynamics CRM 4.0 - Thought Repository

Friday, September 11, 2009

Shortcut to Email Contacts Using Outlook

View Comments

While CRM 4.0 has a built in feature to email contacts, I've found it a bit less than intuitive for end users. When a user clicks the "Send Email" button in a Contact record, a new CRM form opens up giving them room to type in an email but also presents form fields for the CRM Email Activity. When the user types up the email and clicks send, if you haven't configured an email server for CRM, the email isn't actually sent off immediately. Rather, the user has to wait for their Outlook to sync with the CRM servers and send it out through their own inbox, which can cause some confusion. Some users would prefer to quickly shoot off a quick email using the familiar Outlook interface, without having to copy and paste the Contact's email address. By adding a custom ActionButton, this is a simple addition.

The javascript code below creates an ActionButton which I detailed in a previous post. The code has been modified to add the emailing functionality. I've used the attribute emailaddress1(Email) for this example.
//replace 'emailaddress1' with the name of your custom attribute, make sure you keep the '_d' ending
function loadjscssfile(filename, filetype){  
  if (filetype=="js"){  
    var fileref=document.createElement('script')  
    fileref.setAttribute("src", filename)  
  else if (filetype=="css"){  
    var fileref=document.createElement("link")  
    fileref.setAttribute("rel", "stylesheet")  
    fileref.setAttribute("type", "text/css")  
    fileref.setAttribute("href", filename)  
  if (typeof fileref!="undefined")  
//load some styles to display link image and hovering link image  
loadjscssfile("http://" + + "/ISV/styles/openEmail.css", "css")  
var linkTD = document.getElementById("emailaddress1_d");  
var siteIMG = document.createElement("img");  
var siteA = document.createElement("a");

//create img overlay to show "Send Email to Contact" when icon is hovered and store javascript to open link = "22px"; = "19px";  
siteIMG.setAttribute("title", "Send Email to Contact");  
siteIMG.setAttribute("alt", "Send Email to Contact");  
siteIMG.setAttribute("src", "http://" + + "/ISV/styles/blank.gif");  //1x1 pixel blank overlay image = false;  

//create img  
siteA.setAttribute("href", "mailto:"+crmForm.all.emailaddress1.DataValue); = "absolute";  
siteA.className = "openEmail"; = "2px"; = "4px";  
siteA.appendChild(siteIMG); = "relative";  
The images and files used in the sample can be found here: Download Zip

Make sure to put these files in "C:Program Files\Microsoft Dynamics CRM\CRMWeb\ISV\styles" the ISV folder of your CRM 4.0 on premise install. By default, a 'styles' folder does not exist so please create one.
While this feature might seem trivial, every little bit helps in ensuring a great CRM experience!

blog comments powered by Disqus

About Me

Henry Bow
I'm a programmer living in sunny Orange Country, California. Since the beginning of 2008, I've been developing on the MS Dynamics CRM 4.0 platform. This blog will help me jot down some of the tips and neat features I've developed along the way while giving me a chance to dabble into the curious world of analytics and SEO.

Please let me know if I can help with your CRM needs.

Feed Rss

Subscribe to new posts via e-mail

Recent Posts