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

S-control to shut off Self Service

First is this even possible?  I tried using an APEX trigger but the SelfServiceUser object is not avialable.
If it is possible can anyone figure out what is wrong with this script?  I am get an "Object Expected" error on line 40 which is the Body tag.
Generated by AJAX tools
Date     :  Mon Apr 14 2008 14:54:35 GMT-0400 (Eastern Daylight Time)
Template :  simple.html by
SControl   :  ShutOffSelfService
<head><script  type="text/javascript">function getRecordIds(keyPrefix) { return [] }</script>
<script  type="text/javascript">__sfdcSessionId = '100d00D300000000PXI!AQEAQIIvyieXwYFnhWBj0aa_vaic3bxkoXnIjKlcP_DQ3u1hlr0eR95Ziqyh5ITLEe2nKuBWqOxk.aAG1GaLHELvCsPxW0q9'</script>

<script src="/soap/ajax/8.0/connection.js"></script>
<script src="/js/dojo/0.3.1/dojo.js"></script> 
<script src="/soap/ajax/8.0/apex.js"></script> 
function doit()
 var doc = document.getElementById("output");
 doc.innerHTML ="start";
  var result = sforce.connection.query("SELECT Id FROM Contact Where AccountId=00130000002Ufha");
  var it = new sforce.QueryResultIterator(result);
   var record =;
   var ssu = sforce.connection.query("SELECT Id FROM SelfServiceUser WHERE Active=true AND ContactId=" + record.Id);

   ssu.Active = false;
   var result2 = sforce.connection.update([ssu]);
 catch (Exception e)
  doc.innerHTML ="error";
 doc.innerHTML ="done!";
<body onload="doit()">
<div id="output"></div>

Hello cmarzilli,

I'm not an expert in JavaScript but can you tell me where you are getting the .next() function you are utilizing? I have not seen it before and can't find it in the .js files you are including in the code.