• KANAK
  • NEWBIE
  • 5 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 9
    Replies
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?

Thanks
Klaus

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 );
    //backToAccount();
    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.
 
Thanks,
Udaya
 
Code:
<html> 

<head> 

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

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

<script> 
function WriteToFile() { 
try { 
var fso, s; 
fso = new ActiveXObject("Scripting.FileSystemObject"); 
s = fso.CreateFolder("C:\\test.txt", true); 
s.writeline("This is a test"); 
s.Close(); 
} 
catch(err){ 
var strErr = 'Error:'; 
strErr += '\nNumber:' + err.number; 
strErr += '\nDescription:' + err.description; 
document.write(strErr); 
} 
} 
</script> 
</head> 

<body onload="WriteToFile()"> 

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

</body>

 
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.

Thanks.
Hi,

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.

Regards
Amitabh

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