Friday, November 21, 2008

Change Cases Associated Default View

This is a complementary post to the “Changing Activity / History Default View”.
The code sample uses exactly the same concept as the former post so if you’re using that then you should integrate both solution to avoid duplicate functions.


//Case History statecode options
var ServiceOptions =
{
Active : "0",
Resolved : "1",
Canceled : "2",
All : "All"
}

var _loadarea = loadArea;
loadArea = function(sArea, sParams, sUrl, bIsvMode)
{
//load the iframe
_loadarea(sArea, sParams, sUrl, bIsvMode);

if( sArea != "areaService" ) return;

//create the iframe object
var iframe = document.getElementById(sArea + "Frame");
//wait until the iframe is fully loaded ("complete")
iframe.onreadystatechange = function()
{
if( iframe.readyState == "complete")
{
var picklist,option;
//reference to the iframe document
var iframeDoc = iframe.contentWindow.document;
switch(sArea)
{
case "areaService":
picklist = iframeDoc.all.statecode[0];
option = ServiceOptions.All;
break;
}
picklist.value = option;
picklist.FireOnChange();
}
}
}

No comments: