Change Activity History to "All" instead of "Last 30 Days"

by Bill Owens 19. February 2009 23:04

David Fronk Dynamic Methods Inc. 2/13/2009 09:13:00 AM


While there have been other bloggers out ther who have blogged about this topic (Stunnware, CustomerEffective, etc) this request is made so often and the answer isn't always the easiest to find...so my hope is that if more of us MSCRM bloggers blog about then it should be easier for everyone to find and use. This code snippet comes from Stunnware (here's the link).
Just take the code below and put it in your onLoad script and you should be all set.
Enjoy!

/************************************************************** 


* Change the default view of a view selection combo box


**************************************************************/


SetDefaultView = function(viewCombo, viewName, appGrid) {


/* 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 RefreshGridView to run the code in the DHTML control.


* Without this call, only the selection in the combo box changes,


* but not the content of the grid */


appGrid.RefreshGridView();


}


}


/**************************************************************


* 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");


/* This is the AppGridFilterContainer control we need to refresh the view */


var appGrid = frame.document.getElementById("AppGridFilterContainer");


/* 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", appGrid);


}


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", appGrid);


}


}


}


}


}


/* Set a new onclick event for the History navigation element


* This is where we register the onreadystatechange event handler */


if (document.getElementById('navActivityHistory') != null) {


document.getElementById('navActivityHistory').onclick = function() {


loadArea('areaActivityHistory');


document.frames('areaActivityHistoryFrame').document.onreadystatechange = areaActivityHistoryFrame_OnReadyStateChange;


}


}






David Fronk


Dynamic Methods Inc.

Tags: , ,

CRM 4.0

Page List

About the author

I work for a consulting firm in Dublin Ohio called Affiliated Resource Group. For the last five years I have been spearheading our Microsoft Dynamics CRM practice. I have a deep appreciation for the Microsoft CRM platform and I am very excited about it. You might even describe me as a Microsoft CRM Advocate. I have many battle scars from my experience with the product and I’m constantly being asked questions about CRM and how-to-do something in it. Hence, this BLOG is to help disseminate that knowledge and information to everyone. As of last year I was posting links to many other blogs to help spread the knowledge, but now with the community.dynamics.com doing that for me, I will be following that practice unless a really juicy article catches my eye. Many people have asked where my post are for the first half of 2010, my company had me posting to another blog and maintain two was near impossible. I am now down to just this blog. So good luck and I hope that this blog may help in some way. If you have suggestions or questions, please email me them.

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2012 BillOnCRM