I tried to change the area code to areaContracts, but i does not work (:
I would also like to change the filter for Invoices, orders and Quotes to
default view as "All".
Here is the code:
/**************************************************************
* 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.
**************************************************************/
areaContracts_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("areaContracts");
/* 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");
}
}
}
}
}
/* Load the history area. The loadArea function is defined in the CRM
* server files */
loadArea('areaActivityHistory');
/* 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("areaContracts").document.onreadystatechange =
areaContracts_OnReadyStateChange;
Does anyone have any idea about the solution that would work.
Thanks
Andrej
"Andrej Strojin" <Andrej Str...@discussions.microsoft.com> wrote in message
news:7CC283AB-CCB2-47A1...@microsoft.com...
I had done it. The corect code is:
/**************************************************************
* 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.
**************************************************************/
areaContractsFrame_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("areaContractsFrame");
/* And this is the view combo box */
var viewCombo = frame.document.getElementById("statecode");
/* 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('areaContracts');
/* 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("areaContractsFrame").document.onreadystatechange =
areaContractsFrame_OnReadyStateChange;
But I still haven resolved, how to change the default filter for Invoices,
Orders and Quotes.
Is it possible to change the default view of 4 entities at the same time,
with onLoad function?
Andrej
--
Michael Höhne, Microsoft Dynamics CRM MVP
Web: http://www.stunnware.com/crm2
Feed: http://www.stunnware.com/crm2/atom.aspx
Custom Lookup Dialog: http://www.stunnware.com/crm2/?area=customLookup
The JavaScript Snippets Directory:
http://www.stunnware.com/crm2/topic.aspx?id=JS13
----------------------------------------------------------
"Andrej Strojin" <Andrej...@discussions.microsoft.com> schrieb im
Newsbeitrag news:77F73413-B824-4F5E...@microsoft.com...
Entity - Opportunity:
The area name: areaOpps
The name of the frame containing the view combo box: areaOppsFrame
The name of the view combo box : statecode
Entity - Quotes:
The area name: areaQuotes
The name of the frame containing the view combo box:areaQuotesFrame
The name of the view combo box : statecode
Entity - Orders:
The area name: areaOrders
The name of the frame containing the view combo box: areaOrdersFrame
The name of the view combo box : statecode
Entity - Invoices:
The area name: areaInvoices
The name of the frame containing the view combo box: areaInvoicesFrame
The name of the view combo box : statecode
They all have the unique area name and the same name for the combo box.
I tried to combine the together but i haven had any luck.
Does anyone have and idea how to make this work?
Thanks
Andrej
It might be silly but you could just copy the same code, change the
necessary value names (you know where) and rename the functions to something
else. What do you think?