+ 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 manoj@cheenath.com
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 = it.next();
   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.