Spell checking on send of an Email in CRM 2016 using Speckie

John Towgood, 23 February 2016

Speckie is a spelling checking add-on for Internet Explorer which is installed onto the client's machine. Once the add-on is enabled the spell checking functionality will be applied to all web pages viewed in Internet Explorer. Since Dynamics CRM 2016 is a web application and can be viewed in Internet Explorer, the spell checking functionality provided by Speckie can be applied to all input fields on a CRM form.

In order to implement javascript to programmatically access Speckie features the commercial version of Speckie needs to be purchased and installed.

Customizing the Email Form by added a new command bar button called "Spell Check On Send" that will execute a custom javascript function SpellCheckOnSend()

The following dialog is only presented to the user if there are misspelt words in the body of the email, also the dialog displays the number of misspelt word.

 

User can right-click on words identified by Speckie as misspelt and open the Speckie Dialog to select from a list of suggested words.

The following javascript is used to programmatically access the Speckie javascript library and executing the function GetTaggedWordCount() to return a count of all words that are misspelt. The number of count defines the logic of whether or not the dialog above is displayed.

function SpellCheckOnSend() { var speckie = window.parent.Speckie; var iFrameDescrption = window.parent.document.getElementById('descriptionEditIFrame'); var iFrameBody = iFrameDescrption.contentWindow.document.getElementsByTagName('body')[0]; var wordCount = speckie.GetTaggedWordCount(iFrameBody); if (wordCount > 0) { var message = "There are " + wordCount + " words that needs spell checking.\n Do you want to correct the misspelt words before sending?"; if (wordCount == 1) { message = "A word needs spell checking.\nDo you want to correct this misspelt word before sending?"; } Xrm.Utility.confirmDialog(message, null, function () { SendEmail(); }); } else { SendEmail(); } }

The Speckie javascript library is only accessible by custom javascript libraries due to the new Turbo Forms design in Dynamics CRM 2016. The new Turbo Forms have custom javascripts libraries loaded into the ClientApiWapper child iframe therefore to access the Speckie library which is loaded into the parent iframe you would need to use window.parent.Speckie