• 5 Points
  • Member since 2007

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 9
Hi, I have an SControl which needs to create an SObject. Everything would be fine, if creating of the object would work. When I call the function below, it shows the indicated alerts. After that (obviously in the "var result = sforce.connection.create([sample]);" line the program drops out without error, warning or any other sign. The object is not created. There are only the 2 datafields which have to be filled, no other fields are mandatory.

Does anybody have an idea what to do?


function createSample(){

  alert("1" ); //shows up
  var sample = new sforce.SObject( "Trip_Report__c" );
  sample.Contact_Name_Department__c = sumlist;
  sample.Account__c = "{!Account.Id}";
  alert( sample.Account__c ); // shows val, thus indicating, that the object sample exists
  alert( sample.Contact_Name_Department__c ); // shows val

  alert("2"); // shows up
  var result = sforce.connection.create([sample]);
  alert( "3" ); // does not pop up
  if (result[0].getBoolean("success")) {
    alert( result[0].id );
    window.top.location.href = "/" + result[0].id; //"/{!Account.Id}";
  } else {
    alert("failed to create Object " + result[0]);
  • October 11, 2007
  • Like
  • 0
Hi All,
I have created a button and on click of this i am trying to save a .txt file in to my local machine. PFB the code. But when i execute this, i am getting the following error.
Error: Number:-2146827859 Description:Automation server can't create object
Any solution on this will b really helpful.


<script src="/soap/ajax/9.0/connection.js" 


function WriteToFile() { 
try { 
var fso, s; 
fso = new ActiveXObject("Scripting.FileSystemObject"); 
s = fso.CreateFolder("C:\\test.txt", true); 
s.writeline("This is a test"); 
var strErr = 'Error:'; 
strErr += '\nNumber:' + err.number; 
strErr += '\nDescription:' + err.description; 

<body onload="WriteToFile()"> 

<div id="output"> </div> 


This sounds very basic but I can not find an example of how to do this.
I want to put a button on the Opportunity detail page Button Section. When clicked this should set custom checkbox field EmailDistribute_c to true.
(EmailDistribute is linked to workflow to send an HTML email to Account Team, Account owner etc.)
  • October 09, 2007
  • Like
  • 0
Does anyone have sample code for an s-control assigned to a button that would provide an excel download stream to the user when they clicked the button?  I want to try to emulate the fuctionality found in Salesforce reports.  Any suggestions are appreciated.


I have a problem I have created a  scontrols, which I am running through custom button link.

The button is visible to all the users in my organisation, but when they run the scontrol in the existing window with side bar.

The window and side bar appears and the rest of the screen just blanks out.

I have checked all the field level permissions they are perfectly all right.

Please help me out.

Thanks in advance.


Message Edited by Amitabhleo on 10-08-2007 04:21 AM