The Scripting Pipelet

There’s only one scripting pipelet, located in the Scripting folder in the B2C Commerce API. This pipelet executes a Server-Side JavaScript, which might require a database transaction.

The pipelet’s configuration parameters are:

PropertiesDescription
OnErrorCalls PIPELET_ERROR to process the error
ScriptFileThe name of the actual script relative to the script’s folder containing the pipeline
TimeoutTimeout in seconds. Default is 30 seconds.
TransactionalSelection of false or true

Using ScriptLog 

ScriptLog is a transient object for retrieving detailed log information during script execution. Use ScriptLog information during development to report any errors.

Put this object into the Pipeline Dictionary before using it. To add it to the pipeline dictionary, in the script node, under Dictionary Output, add a variable name to the ScriptLog property. For example, add myLog as the variable name.

Note

Display ScriptLog data in any template with a simple ISML statement.

1<pre>
2<isprint value="${myLog}">
3<pre>

To generate persistent log information, use dw.system.Logger.

Note

Using Trace() 

Write your own information with the trace() function.

Use the following syntax:

1trace(msg : String, params : Object...)

To use the trace() command, you must first specify the variable and then show it in a window, as shown here:

1var res = googlesvc.doGoogleSearch(
2...
3);
4trace( res );

This example writes to the ScriptLog output.