For an account record, the associated view of Contract would have default filter set as Draft. So if we want to change it to some other status for example “Active” we can make use of the following JavaScript for that.
This JavaScript is based on the popular JavaScript code used for hiding “add existing button”
Please check this wonderful article
http://blog.davehawes.com/post/2008/04/23/MSCRM-4-Remove-Add-Existing-xxxxx-button.aspx
The JavaScript code for changing default option
var navElement = document.getElementById('navContracts');
if (navElement != null) {
navElement.onclick = function LoadAreaOverride() {
loadArea('areaContracts');
SetDefaultOption(document.getElementById('areaContractsFrame'));
}
}
function SetDefaultOption(Iframe) {
if (Iframe != null ) {
Iframe.onreadystatechange = function SetOption() {
if (Iframe.readyState == 'complete') {
var iFrame = frames[window.event.srcElement.id];
var selectBox=iFrame.document.getElementById('statecode');
selectBox.options[2].selected=true;
}
}
}
http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/85615ccd-b8e9-48d3-a906-4fd7b301dac0
Bye..
Discover more from Nishant Rana's Weblog
Subscribe to get the latest posts sent to your email.

I am working on creating a blog like Changing default filter for Contracts Associated View for Account. Nishant Rana's Weblog. I still have a a long way to go, and surely do not yet get the traffic you seem to get. when you can, please give me some feedback on http://investolife.com/vb/member.php?u=50799 as I know it really needs a tune up. Nice web-site, sincerely, Tasha Knapp
LikeLike