Sunday, June 13, 2010

Set default view for Service Calendar in Microsoft Dynamics CRM 4.0

My customer asked me to set default view for Service Calendar to 'Facility/Equipment'. I haven't found any available supported solution for this task, so I decided to use unsupported approach - inserting JavaScript in page of Service Calendar.

1. You should open folder of Microsoft Dynamics CRM website.
2. Open SM Subdirectory and open for editing home_apptbook.aspx file.
3. Locate following lines:

<cnt:AppHeader runat="server" id="crmHeader"/>

4. Modify this text to following:
<cnt:AppHeader runat="server" id="crmHeader"/>
<script type="text/javascript">
OnLoadCompleted = function()
var combo = document.getElementById('crmTypeSelector');

combo.value = 'equipment';
window.setTimeout(function() {OnViewTypeChange(combo);}, 0);

window.attachEvent('onload', OnLoadCompleted);