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
kMans2kkMans2k 

Error with Delete Call

Hello all,
 
I have a s-control that brings-up a new html page when the corresponding button is pressed.
 
The Html page displays some details of a custom Salesforce Object using the onload event. It also contains a delete button that I am attempting to use to delete a custom Salesforce Object. Following is my code with irrelevant parts removed. If I have the code for "deleteForm" in, the page fails to load information about the object. If I don't, it does. This leads me to believe that something is wrong with the "deleteForm" code. Any help please?
 
<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/11.0/connection.js"></script>
<script src="/soap/ajax/11.0/apex.js"></script>
<script type="text/javascript">
 
deleteForm()
{
  if( formId != "" ) {
 String[] ids = new String[] { formId };
 try {
   DeleteResult[] deleteResults = sforce.connection.delete(ids);
 }
 catch( Exception e ) {
 }
  }
}
 
loadForm()
{
  var conn = sforce.connection;
  var qr = conn.query("Select Id....");
  var record = qr.getArray("records");
  formId = record[0].get("Id");
}
 
<body>
.....
<input type="button" name="deleteForm" value="Delete Form" onclick="deleteForm()" />
</body>
HardhatHardhat
Did you try using firebug to find out exactly what the error is?