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
CSB-SFCSB-SF 

Scontrol No Longer working :-(

Scontrol [pasted below] used to Calculate Payments has been working fine in Safari & Microsoft Edge [hasn't worked in Firefox or Chrome for a long time, so users have been instructed to use Safari. 
As of October 29th, Scontrol no longer working in any browser. 

I know Visualforce pages have superseded s-controls, but I understood that existing Scontrols would continue to be supported.

Please help! Scontrol is used every day by our users!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html><head><title></title>

<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" >

<link href="/css/assistive.css" type="text/css" media="aural,braille,embossed" rel="stylesheet" >




<script src="http://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" 

type="text/javascript"></script>

<script type="text/javascript" src="/js/functions.js"></script>

<script type="text/javascript" src="/js/setup.js"></script>

<script type="text/javascript" src="/js/roletreenode.js"></script>




<script language="javascript" type="text/javascript"> 




var OppId = ('{!Opportunity_ID}')




function onLoad() { 

// get session id and initialose the sforceClient object 

sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}"); 

//check everything is ok 

if (sforceClient.getSessionId().indexOf("!API_Session_ID") != -1) { 

alert("Could not connect to the API service"); 

} else { 

start(); 

} // onLoad() 






function start() { 




sforceClient.setBatchSize(200); 

var queryResult = sforceClient.query("Select Id, Amount__c From TuitionPayment__c WHERE Opportunity__c = '" + OppId + "'");




if (queryResult.className == "Fault")



alert("There was an error: " + queryResult.toString());

}

else

{

if (queryResult.size > 0)

{

var UpdateAmount = 0;

for (var i=0;i<queryResult.records.length;i++)

{

var dynaBean = queryResult.records[i]; 

UpdateAmount = UpdateAmount + dynaBean.get("Amount__c");




}




var UpdateOpportunity = new Sforce.Dynabean("Opportunity");

UpdateOpportunity.set("Id",OppId); 

UpdateOpportunity.set("Total_Payments__c", UpdateAmount);

UpdateOpportunity.save(); 



}




window.setTimeout('window.close()', 1000);

opener.location.reload();

parent.parent.frames.location.replace("https://na4.salesforce.com/" + OppID)




}

</script>

</head>

<body onLoad="javascript:onLoad();">

<center>

<br><br><br>

<SPAN STYLE=" font-size: 75%; font-family: 'Arial', 'Helvetica', sans-serif;"> 

Please wait ...

</span><br><br>

<img src="/img/waiting_dots.gif" alt="Please wait..." title="Please wait..." height="20" width="196">

</center>

</body> 

</html>

 
James LoghryJames Loghry

As you know scontrols have long been superseded by visualforce pages.  What you have here looks like it could be easily replaced with visualforce, as it is mostly javascript anyway.  I would consider going down that route rather than trying to make your scontrol work again.
CSB-SFCSB-SF
Thanks James - very new to Visualforce so trying to explore now how I might do this! There's a lot to learn!

Any idea why an Scontrol would mysteriously stop working without any changes on my end?