About Calling the ABS and Optimizer Methods

A script can call the Appointment Booking System and Optimizer (or Optimization Engine) by calling the predefined Server Requests business service and specifying the Appointment Booking Engine or Optimizer component. The methods must be loaded and exist on the server before they can be called. Only the Server Request Broker can determine the correct component to call for a service region. For more information about using the Server Requests business service, see Siebel Business Process Framework: Workflow Guide.

The following script is an example of how to call the ABS component with the GetAppointment method.

var SRMSvc, BSWrite, BSRead;
var srmInputs, apptBookInputs, srmOutputs, tempPropSet;
var childPropSet, activePropSet, apptPropSet;
var errCode;
// use Server Request to call the Appointment Booking Engine
SRMSvc = TheApplication().GetService("Server Requests");
srmInputs = TheApplication().NewPropertySet();
apptBookInputs = TheApplication().NewPropertySet();
srmOutputs = TheApplication().NewPropertySet();
tempPropSet = TheApplication().NewPropertySet();

srmInputs.SetProperty("Mode", "Sync");
srmInputs.SetProperty("Method", "GetAppointment");
srmInputs.SetProperty("Component", "ApptBook");
apptBookInputs.SetProperty("ActId", "1-93J9");
apptBookInputs.SetProperty("SvcRegnId", "1-1BGD");

srmInputs.AddChild(apptBookInputs);
SRMSvc.InvokeMethod("SubmitRequest", srmInputs, srmOutputs);

// write out the outputs for debugging
childPropSet = TheApplication().NewPropertySet();

activePropSet = TheApplication().NewPropertySet();

childPropSet = srmOutputs.GetChild(0);
errCode = childPropSet.GetProperty("ErrCode");

if (errCode == "0")
  {
  var apptCount = childPropSet.GetChildCount();
  apptPropSet = TheApplication().NewPropertySet();
  for (var i = 0; i < apptCount; i++)
     {
     activePropSet = childPropSet.GetChild(i);
     apptPropSet.AddChild(activePropSet);
     }
  // write out the inputs for debugging
  apptPropSet.SetProperty("number of appointments", apptCount);
  apptPropSet.SetType("addedPropSet");
  Outputs.AddChild(apptPropSet);
  }
else
{
}
activePropSet = null;
tempPropSet = null;
childPropSet = null;
SRMSvc = null;
BSWrite = null;
BSRead = null;
srmInputs = null;
apptBookInputs = null;
srmOutputs = null;