The toSource Method

In JavaScript, the toSource method is used to return a string representing the source code of the object. However, this feature is obsolete and should not be used. In SuiteScript 2.0, a script that includes the toSource method for an object executes without error. In SuiteScript 2.1, an error is thrown for any script that includes the toSource method for an object. For more information about the toSource method, see toSource.

Scenario

SuiteScript 2.0 Behavior

SuiteScript 2.1 Behavior

Log a Transaction source:

                    function Transaction(name) {
    this.name = name;
}
var obj = new Transaction("myTrans");
log.debug("Transaction = ", Transaction.toSource());
log.debug("Transaction Obj = ", obj.toSource()); 

                  

The script completes execution without throwing an error.

An error is thrown indicating toSource is not a valid function.

Related Topics

General Notices