Ch 16 Scripting

WebSphere Product Center's Scripting Engine allows for extremely sophisticated data manipulations during the import or export of information to and from WebSphere Product Center. With this added flexibility to your product information management capabilities, users can do the following:

Scripts Console

Using the Scripts Console, users can view, create, and edit scripts of the following types:

Catalog Differences Export

The Catalog Differences Export script allows the update of product information to an external destination. The script does not provide a full update, but only the changes that have been made since the last version of the catalog.

For example, if the images for a line of products have changed, these changes can be updated without having to update the entire catalog.

Catalog Export

Catalog Export scripts are used during syndication. They can be used to perform advanced on-the-fly operations on the data held in the catalog before it is actually exported to an output file. The modifications made to the content through the scripting engine at the time of syndication are not applied to the catalog but rather simply applied to the output file, as a one-time content modification.

Similar to aggregation, the syndication to an external target file can take two forms: either the fields in the catalog map on a one-to-one basis to the external target file, or the fields in the catalog require some modifications before they are exported into the external target file.

All syndications require the use of a script. Contrary to aggregation, selecting a script during syndication is a mandatory step.

Catalog Import

Catalog Import scripts are used during aggregation and can be used to perform advanced operations on incoming data before it is imported into a catalog. Simple scripts are generated from WebSphere Product Center, with no customization, but can be user specific with as many modifications as necessary.

The aggregation of an external file is taken in one of two types:

  • Mapped on a one-to-one basis to the fields of a catalog
  • Modifications performed before being imported into a catalog
Catalog Preview Script A Catalog Preview script is used to create a user-defined preview of a catalog. The script defines how the catalog is displayed.
Catalog Script A Catalog script is a sequence of operations that a user specifies to be run at the time of item creation and edit. This function provides another layer of functionality over the attribute level operations available via catalog specs.
Catalog to catalog export script A Catalog-to-Catalog Export script allows the automation of an export where information from one catalog is exported into another catalog.
Custom tools Create a script to work with custom tools. Functions related to the custom tools can be created.
Distribution script

Distributions scripts are used to create a custom distribution that is not addressed by the built-in WebSphere Product Center distributions (i.e. Ariba Catalog Upload, FTP, HTTP POST and email.)

Entry build script The Entry Build script allows a user to execute a script within the data entry screens. For example, a script could be written to replace all strings with a certain value.
Entry Macro script

The Entry Macro script allows a user to execute a script within the data entry screens. For example, a script could be written to replace all strings with a certain value.

Entry Preview script

The entry preview script allows a user to create a sample view of a current item set, which can be executed from the data entry screens. For example, a script could be written to view how an item would display using an XML format.

Hierarchy Import script

This function is used during aggregation. Although a user can create a hierarchy manually, the Hierarchy Import script allows the building of a full hierarchy out of an incoming flat file.

Hierarchy script

The Hierarchy Script allows a user to build a hierarchy without having to manually create one.

Images and Binary Files Differences Export script

Images and Binary Files Export script take catalog images or binary type files and exports them through syndication. With the Images and Binary Files Differences Export script, a user can export changes that have been made from a previous catalog version.

Images and Binary Files Export script

Images and Binary Files Export script take catalog images or binary type files and exports them through syndication. In most cases, images and binary files are handled differently; therefore the scripts allow these types of files to be exported based on the external systems requirement.

Lookup Table Import script

Lookup table scripts are very similar to aggregation scripts in that they are used to parse an incoming text file. When triggered through the lookup table interface, they are used to populate the contents of a lookup table instead of a catalog.

Order export script Create a script to execute order distributions.
Order import script Create a script to execute order imports.
Order status update import script Used to create a status update on order imports.
Queue message processor Create scripts to process queue messages created in Websphere Product Center
Report script

Report scripts are used to create custom reports. When creating a report in WebSphere Product Center, a script is needed to define the report output. The report script is used to define how the information is ordered and formatted.

Secure Trigger script Similar to a regular trigger script with additional security.
Trigger script

Trigger scripts are created to avoid the need to populate the same script operations in multiple places. The scripts are stored in the Document Store and can be called from another script function.

Used to externally trigger events, i.e. import, exports, etc., in WebSphere Product Center.

Web Service Implementation script Create a script to implement web services
Workflow step This script is used to automatically create workflow steps, which can then be viewed using the Workflow Console.

Creating New Scripts

To create new scripts do the following:

1. Click Data Model Manager > Scripting > Scripts Console. The Scripts Console appears with a user-friendly navigation bar.

2. From the navigation bar, select a type of script to create. The script console appears with a list of associated scripts. For example, if "Catalog Export Scripts" was selected, a list of created catalog export scripts appears, if any.

3. To create a new script of the selected type, click the New button, from the Scripts Console interface. A wizard-driven GUI appears.

4. Follow each step of the wizard. In step four, the script editor appears. This is where script is created.

5. When the script is complete, click the Save at the bottom of the screen.


Script Sandbox

The Script Sandbox provides an expression builder with a library of available script operations with a prototype and description (The Prototypes and Description fields do not appear until "Script Operations" is selected.

Users can create sample scripts, which can then be run and tested to see if the results are valid. Click "Run Script" to compile and return an expected value or error, which is viewable to the user. This is a great way to test a script before it is implemented.