+ Start a Discussion

JavaScript Error "log is not defined" while trying sforce.debug.log

I am trying the following code in an OnClick SControl


sforce.debug.trace = true;
sforce.debug.log("Hello World");

and I am getting a browser error which says "log is not defined"

When I use Firebug to inspect connections.js I see the following code ...

sforce.internal.Debug = function() {


this.log = function(str) {
  this.println(str, "print");

sforce.debug = new sforce.internal.Debug();

 I am confused. Shouldn't this be working? This stopped working in an old SControl I built, so I am sure something has changed.

Any help would be appreciated




User Console.log('Value')


function callscript() {
var result = sforce.connection.queryAll("Select Name, Id from Account");
var records = result.getArray("records");

for (var i=0; i<records.length; i++) {
var record = records[i];
console.log(record.Name + " -- " + record.Id);