Fixing a Broken Add Email Button for CRM 2015 Cases in Outlook Client

Isaac Stephens, 29 February 2016

There's a very conditional error that occurs when using both Microsoft Dynamics CRM 2015 and the Outlook Client 2015 to connect to it. The bug occurs when you select an existing case, go to the Add tab and click Email - nothing happens. This is interesting because the other buttons such as Phone Call and Task work fine, properly opening a record in a new window.


Searching around for solutions to the error or other reports of its occurrence didn't turn up much, so it might be that this bug is very specific to a certain set of conditions, or perhaps nobody has taken notice of it until now. If you're experiencing this issue, you might be happy to know that we've come up with a workaround.

After some investigation and debugging, it turns out that the bug lies fairly deep in some Microsoft JavaScript that's triggered by the button, which crashes before it gets a chance to open a new Email window. After a bit of tweaking, we came up with a fix which can be packaged into a small solution containing just the Case entity and a custom JavaScript file.

To replicate the fix, firstly you'll need the Ribbon Workbench to make a slight tweak to the ribbon button. You can get this from, if you don't have it installed in your development environment already. Just follow the installation instructions from their website before reading further. The product comes as a managed solution which you install into your development system like any other solution.

With the Ribbon Workbench installed, next create a new unmanaged solution. This will be your hotfix solution for the bug, so name it something appropriate and add the Case entity to it.

You also need to create a new JavaScript web resource containing a small amount of JavaScript to fix the issue, so create a new one and name it something like ButtonFix.js. Populate the file with this JavaScript fragment:

Mscrm.AddActivity.getPartyDetailsForRefreshForm = function(entityType) { return null; }

Your solution should look similar to this:


Now save the solution and open the Ribbon Workbench. When it prompts you for a solution to load, select the one you've just created and wait for it to finish loading.

Now to go the Ribbon, then the Add tab, then right click on the Email button and select Customize Command.


You'll want to find the command named Mscrm.SendEmailToSelectedRecord – this is the command that fires when the user clicks the offending button. Right click on it and click Edit Actions. Here's where we'll add a new action that gets triggered before the default Microsoft one.


Click Add to add a new action, choose a JavaScript Function Action, and then click on the up arrow next to the list of actions to move the new action to the top of the list.

Put 'IsNaN' into the FunctionName field, and in the Library field you need to select the JavaScript web resource which you created earlier.


That's all the customization you need to do to the ribbon, so you can click ok on that dialog, hit the Publish button in the top left corner, and wait for the lengthy publishing process to finish. You've now got a solution which contains one JavaScript web resource and some ribbon changes added to the Case entity. Simply deploy the solution to the environment which Outlook connects to and the issue should be resolved.

With any luck, Microsoft will address this issue in a future patch, but for now we can at least work around it with this fairly simple fix. Hopefully this blog can save you some time and hassle, however uncommon this bug might be.