Unsupported method for adding Calibri in email font selection of MSCRM 4.0/2011


Starting from Office 2007, Calibri became the default font and almost all the Outlook users just send out their mail with default font. So, for some organizations who send out email directly from CRM web client, they want an option to add the 'Calibri' font into CRM's font selection field in the email form and make it as the default font believing that it may result in a more consistent corporate image.
In order to achieve this, we've got to do unsupported modification of one aspx file in MS CRM application and so should only ever be used with caution.
This method is adding LOCID_HTMLBAR_DEFAULTFONTS in the aspx file to override the default values.

In CRM 4.0, we need to add the following line of code in "..\CRMWeb\Activities\email\edit.aspx" file.
<script language="JavaScript" type="text/javascript">  
   
// INSERT THIS BLOCK 
LOCID_HTMLBAR_DEFAULTFONTS = "Calibri,Arial,Arial Black,Tahoma,Verdana,Garamond,Times New Roman,Courier New,MS Gothic";  
// INSERT THIS BLOCK END
   
function window.onload()  
{  


In CRM 2011, we need to add the following block of code in "..\CRMWeb\UserDefined\edit.aspx" file.
<head>  
<cnt:AppHeader id="crmHeader" runat="server" />  
   
<!-- INSERT THIS BLOCK -->
<script language="JavaScript" type="text/javascript">  
LOCID_HTMLBAR_DEFAULTFONTS = "Calibri,Arial,Arial Black,Tahoma,Verdana,Garamond,Times New Roman,Courier New,MS Gothic";  
</script>  
<!-- INSERT THIS BLOCK END -->
   
</head>  





In order to make it as the default font for the new email forms, add the following code in onLoad event of email form.
var CRM_FORM_TYPE_CREATE = 1;   
if(crmForm.FormType == CRM_FORM_TYPE_CREATE)  
{  
     document.getElementById("descriptionIFrame").contentWindow.document.getElementsByTagName("font")[0].setAttribute('face', "Calibri, Tahoma, Verdana, Arial");  
}  


The code can be configured for fonts other than "Calibri" according to the user requirements.
For the email templates, we can Copy+Paste from the web pages opened from Internet Explorer for the formats and images (of course those hosted and open to public).

Update: One of the readers asked how to achieve the same thing in the E-mail form dialog in Workflow. In order to apply the same thing for E-mail form dialog in Workflow, you will need to update "..\CRMWeb\SFA\workflow\entityform.aspx" file. This applies for both CRM 4.0 and 2011.
<script language="javascript">  
   
// INSERT THIS BLOCK   
LOCID_HTMLBAR_DEFAULTFONTS = "Calibri,Arial,Arial Black,Tahoma,Verdana,Garamond,Times New Roman,Courier New,MS Gothic";   
// INSERT THIS BLOCK END   
    
window.attachEvent('onload', PageOnLoad);  


Yet again, be warned of the consequences unsupported modification of CRM files, and you may need to re-modify the files again after rollups, upgrades, reinstalltion whenever the files are replaced.

Comments

  1. This works great for adding Calibri to email form under Activites though does not carry through to Workflow emails. Do you have any suggestoin for adding Calibri to the Workflow email form?

    ReplyDelete
    Replies
    1. Thanks for pointing out.
      If you want to apply it for the Workflow email forms as well, you'll need to add LOCID_HTMLBAR_DEFAULTFONTS line in "..\CRMWeb\SFA\workflow\entityform.aspx". It's the same file for both CRM 4.0 and 2011.

      Delete
    2. Thanks for your quick reply. That works great.
      I had originally tried it in the edit.aspx file in the SFA\workflow directory without joy. Your suggestion worked a charm.
      Will make new email based workflows a lot easier. I was getting errors on the workflow email form saying "the email below might contain scripts or content that is potentially harmful and has been blocked" because I had formatted the text in outlook and pasted it into the CRM form. Emails would send out with the Dynamic Value discriptions rather than the actual data. I was working with a workaround utilising the updated Activities Email form but this will be alot more straight forward now.

      Thanks again :)

      Delete
    3. Glad to know that my solution helps you some how in your development.

      Delete
  2. Hi Linn,
    How to i add in ms crm 2011 online? "Calibri (Body) font"

    ReplyDelete
    Replies
    1. Hi Sharma,

      You can use the following script at FormLoad of Email entity to set.

      var CRM_FORM_TYPE_CREATE = 1;
      if(crmForm.FormType == CRM_FORM_TYPE_CREATE)
      {
      document.getElementById("descriptionIFrame").contentWindow.document.getElementsByTagName("font")[0].setAttribute('face', "Calibri, Tahoma, Verdana, Arial");
      }


      But for the email templates and email form in workflows the only possible way is to type in Word and Copy+Paste.

      Delete
  3. How would one set the font size? would it be a method the same as this?

    I've tried using:

    document.getElementById("description").style.font="20px arial,serif";

    ReplyDelete

Post a Comment

Popular Posts