Siebel Analytics Scheduler Guide > Configuring Siebel Analytics Scheduler Job Scripts >

Script for iBot Chaining


The following script copies the results of an iBot to another directory. It copies the temporary file containing the results of the Conditional Request to the iBot log directory. The JobID, InstanceID, and UserID are used in the file name to guarantee that the result sets will not overwrite each other with each execution of the iBot, for each user, or for other iBots that share this script.

The example script uses the following setup:

    • The iBot log directory on the Scheduler machine is \SiebelAnalytics\Log\iBots
    • The iBot is run as Administrator
    • The Custom Script Properties are set according to the table in Configuring Custom Script Properties for Siebel Delivers
    • The job ID is 101 (assigned by the Scheduler)
    • The instance ID is 1208 (assigned by the Scheduler)

The output of this example, after the iBot is run, is a file on the Scheduler machine called D:\SiebelAnalytics\Log\iBots\101-1208-Administrator-iBotScript1.PDF. This file contains the results of the Conditional Request in PDF format.

For all scripts from chained iBots, the full path name to the temporary file is specified in Parameter(0).

/////////////////////////////////////////////////////////////
//
// createResultFile.js
//
// Copies the results in the temporary file to a new file name
//
// Parameter(0) = iBot Result File Path
// Parameter(1) = Last Part of Output File Name (no path)
//
/////////////////////////////////////////////////////////////

var FSO = new ActiveXObject("Scripting.FileSystemObject");

var fileName = GetConfigurationValue("Log Dir", "iBots") +
    "\\" + JobID + "-" + InstanceID + "-" + UserID + "-" +
    Parameter(1);

var fooFile = FSO.CopyFile(Parameter(0), fileName, true);

Siebel Analytics Scheduler Guide