Sunday, January 13, 2013

MS CRM 2011: How to override standard dialogs

My customer wanted to remove (or hide) “Total Time” and “Billable Time” fields in Case Close dialog window:

Of course I knew that it is possible to open file CRM_Installation_Directory'\CRMWeb\CS\cases\dlg_closecase.aspx, add several lines of code and hide fields and labels but this obvious and easiest way out had 2 disadvantages:
1. This solution is unsupported and it could be broken with new Rollups.
2. This solution would not work for CRM Online.
So I decided to solve this task using supported approaches.
Step 1. Create new solution and put Case entity inside:

Step 2. Write JavaScript that will do the same work as original dialog does (the best way is to use SOAP Logger application to get correct request/response xml) and add it to solution.
Step 3: Create dialog to be used instead of standard one and add it to solution. Your solution solution should look like following:

Step 4: Remove original “Close Case” and create new “Close Case” button using Ribbon Customization. I usually do it using Ribbon Workbench:


 Publish changes that you’ve done. Demonstration:

UPD Because I have been asked about source code of solution I uploaded it to skydrive and it is available for download here: