In an earlier blog post of mine, I showed how to Default the Activities ‘Filter on’ to ‘All’ in Dynamics CRM 2011. Unfortunately the code provided in that blog post no longer works with Dynamics CRM 2011 on Rollup 12. This is due to the changes Microsoft have had to make to go cross browser.

Fortunately, I’ve been able to make a few minor adjustments to the JavaScript code in my previous blog post so that it will work with Rollup 12. The new code is as follows (changes from before are highlighted):

//default the Activities 'Filter on' to 'All' for Account and Contact for rollup 12
function filterAllActivities() {
    document.getElementById("navActivities").onclick = function () {
        Mscrm.Details.loadArea(this, "areaActivities");

        document.getElementById("areaActivitiesFrame").onload = function () {
            var entityName = Xrm.Page.data.entity.getEntityName();
            var entity = entityName.charAt(0).toUpperCase() + entityName.substr(1);
            var doc = this.contentWindow.document;
            var filterOn = doc.getElementById("crmGrid_" + entity + "_ActivityPointers_datefilter");

            filterOn.value = "All";

            var evt = document.createEvent("HTMLEvents");
            evt.initEvent("change", false, true);
            filterOn.dispatchEvent(evt); 
        };
    };
}

As with before, this JavaScript is ‘unsupported’. The function above should be added to your Account and/or Contact forms OnLoad event. You don’t need to pass it any parameters, just call the ‘filterAllActivities’ function.

Once this has been saved and published, when you click on the ‘Activities’ link from an Account or Contact, the Activities filter will default to ‘All’ and you will be able to see all of your activities by default. Users can still change the filter to ‘Next 30 days’ for example if required.

Note: I have tested this in Internet Explorer, FireFox, and Chrome.

Default Activity Filter on to All Dynamics CRM 2011 UR12