function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NajoopNajoop 

Owner Active S-control

 

Hi,

 

I am trying to write a html s-control (yeah, still writing s-controls) that shows whether the case owner is active in routing or not on the case detail page. for some reason it is not working as expected.

 

I need to do this as User fields are not available in formula.

 

it just fails (undefined message) when the case owner is a queue and also does not validates the value.

I must be missing something here or logic ay not be correct.

 

here is the code.

 

any help is appreciated. thanks.

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<link href="/dCSS/Theme2/default/common.css" type="text/css" media="handheld,print,projection,screen,tty,tv" rel="stylesheet" >
<link href="/dCSS/Theme2/default/custom.css" type="text/css" media="handheld,print,projection,screen,tty,tv" rel="stylesheet" >
<html>
<head>
<script src="/soap/ajax/17.0/connection.js" type="text/javascript"></script>
<script type="text/javascript" src="/js/functions.js"></script>
<script>
function resizeIframe()
{
var thisWindow = window.name;
if(thisWindow)
{
var iframes = parent.document.getElementsByName(thisWindow);
if (iframes && iframes.length == 1)
{
var height = document.body.scrollHeight;
iframes[0].style.height = height + "px";
}
}
}
function Init()
{
try
{
var SearchString="Select Assignment_Group_Active__c from User where Id = '{!Case.OwnerId}'";
var queryResults = sforce.connection.query(SearchString);
var queryRecords = queryResults.getArray('records');
document.getElementById("mainBody").innerHTML = queryRecords.length;
var txtOutput = "";
txtOutput = "<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
txtOutput = txtOutput + "<tr class='headerRow' height=15>";
var active = queryRecords[0].Assignment_Group_Active__c;
if ( queryRecords.length <> 1 ) {
txtoutput = txtOutput + "<td bgcolor=" + "#F3F3EC" + ">" + 'Invalid owner for routing' + "</td>";
}
if ( queryRecords.length ==1 )
{
txtoutput = txtOutput + "<td bgcolor=" + "#F3F3EC" + ">" + "<img src=" + "/img/samples/light_green.gif" + " height=15 width =28>" + active + "</td>";
}
txtOutput = txtOutput + "</tr>";
txtOutput = txtOutput + "</table>";
document.getElementById("mainBody").innerHTML = txtoutput;
}
catch(error)
{
alert(error.faultline);
}
}
</script>
</head>
<body id="mainBody" onload="Init();resizeIframe()">
<div class="bPageBlock secondaryPalette" style="border-top:0px; border-bottom:0px; margin-bottom:0px; padding-bottom:0px">
<div class=pbBody>
<div class=pbSubsection>
<div id="mainBody">
</div>
</div>
</div>
</div>
</body>
</html>