Also, bei uns sieht das Script jetzt so aus. Es werden anstehende und historische Aktivitäten auf "Alle" gesetzt:
/**************************************************************
* Change the default view of a view selection combo box
**************************************************************/
SetDefaultView = function(viewCombo, viewName) {
/* If the view has already been set, we don't need to do it again. */
if (viewCombo.value != viewName) {
/* Set the new view */
viewCombo.value = viewName;
/* Call FireOnChange to run the code in the appropriate HTML control.
* Without this call, only the selection in the combo box changes,
* but not the content of the grid */
viewCombo.FireOnChange();
}
}
/**************************************************************
* Event handler. Called whenever the ready state of the
* areaActivityHistoryFrame changes.
**************************************************************/
areaActivityHistoryFrame_OnReadyStateChange = function() {
/* Waiting until the frame has finished loading */
if (this.readyState == "complete") {
/* This is the frame we're interested in */
var frame = document.frames("areaActivityHistoryFrame");
/* And this is the view combo box */
var viewCombo = frame.document.getElementById("actualend");
/* The view combo box uses a style sheet that references a HTML
* control. We have to wait until the htc file is loaded,
* otherwise the call to FireOnChange in the SetDefaultView
* method will fail. */
if (viewCombo.readyState == "complete") {
/* If the control already has finished loading, we can * directly set the new view. */
SetDefaultView(viewCombo, "All");
}
else {
/* Otherwise we have to register another event handler
* waiting until all of the include files used by the
* combo box are loaded as well. */
viewCombo.onreadystatechange = function() {
if (this.readyState == "complete") {
SetDefaultView(this, "All");
}
}
}
}
}
areaActivitiesFrame_OnReadyStateChange = function() {
/* Waiting until the frame has finished loading */
if (this.readyState == "complete") {
/* This is the frame we're interested in */
var frame = document.frames("areaActivitiesFrame");
/* And this is the view combo box */
var viewCombo = frame.document.getElementById("scheduledend");
/* The view combo box uses a style sheet that references a HTML
* control. We have to wait until the htc file is loaded,
* otherwise the call to FireOnChange in the SetDefaultView
* method will fail. */
if (viewCombo.readyState == "complete") {
/* If the control already has finished loading, we can * directly set the new view. */
SetDefaultView(viewCombo, "All");
}
else {
/* Otherwise we have to register another event handler
* waiting until all of the include files used by the
* combo box are loaded as well. */
viewCombo.onreadystatechange = function() {
if (this.readyState == "complete") {
SetDefaultView(this, "All");
}
}
}
}
}
/* Load the history area. The loadArea function is defined in the CRM * server files */
loadArea('areaActivityHistory');
loadArea('areaActivities');
/* Immediately switch back to the main form. The previous line is needed
* to initialize the history frame. This line switches back immediately,
* so you see the main application form while the history frame is loaded
* in the background. As the whole entity form is still loading, you
* shouldn't see any flicker on your screen. */
loadArea('areaForm');
/* We have to wait until the the history frame was completely loaded, so
/* we register a new event handler, calling the code above. */
document.frames("areaActivityHistoryFrame").document.onreadystatechange = areaActivityHistoryFrame_OnReadyStateChange;
document.frames("areaActivitiesFrame").document.onreadystatechange = areaActivitiesFrame_OnReadyStateChange;