Siebel Communications Server Administration Guide > Advanced Communications Configuration > Integrating with Siebel Scripting Languages >

Integrating Using Server and Browser Scripts


Siebel eScript scripts are generally supported only for the Object Manager layer, not for the browser layer.

However, Siebel eScript scripts defined on the browser layer can be supported indirectly by using both server scripts and the @InvokeSWECommand special command. See the example below for creating a communications command, a command for the Siebel Web Engine (SWE), and related server and browser scripts.

NOTE:  Transferring data from a server script to a browser script is not supported, due to limitations of SWE commands.

For more information about the @InvokeSWECommand special command, see Special Commands for Device Commands.

Command Example

Table 48 and Table 49 show an example command and associated command data definition that invokes the AlertTest SWE command.

Table 48.  Command: Alert
Parameter Name
Parameter Value
DeviceCommand
@InvokeSWECommand
CmdData
Alert

Table 49.  Command Data: Alert
Parameter Name
Parameter Value
Param.SWECommand
AlertTest

SWE Command Example

In Siebel Tools, create a command named AlertTest with the properties shown in Table 50. This SWE command is executed by the communications command shown above, and in turn invokes the CTI_Test.Alert business service method.

Table 50.  SWE Command Example
Property Name
Value
Name
AlertTest
Business Service
CTI_Test
Force Enable
Y
Method
Alert
Target
Browser

Server and Browser Script Examples

Define the following server script in the CTI_Test business service. The PreCanInvokeMethod server script in the CTI_Test business service allows the SWE command to be enabled that in turn will invoke the browser-layer scripting business service method Alert.

function Service_PreCanInvokeMethod (MethodName, &CanInvoke)
{
   var ReturnVal = ContinueOperation;
   if (MethodName == "Alert")
   {
      CanInvoke = "True";
      ReturnVal = CancelOperation;
   }
   return ReturnVal;
}

Define the following browser scripts in the CTI_Test business service. The PreInvokeMethod browser script invokes the Alert method to create an alert box in the browser.

function Service_PreCanInvokeMethod (methodName)
{
   if (methodName == "Alert")
      return true;
   else
      return ("ContinueOperation");
}

function Service_PreInvokeMethod (methodName, inputPropSet, outputPropSet)
{
   if (methodName == "Alert")
   {
      alert("CTI browser script test");
      return ("CancelOperation");
   }
   else
      return ("ContinueOperation");
}

In the previous steps, you have successfully created a new communications command named Alert. This command can be executed, for example, from the Communications submenu of the View menu, or from a keyboard shortcut. Another option is to further integrate this command with a server script, as illustrated in the following server script example:

function BrowserScriptTest()
{
   // Invoking Browser Script
   var ctibs = TheApplication().GetService("Communications Client");
   var ip = TheApplication().NewPropertySet();
   var op = TheApplication().NewPropertySet();
   ctibs.InvokeMethod("Alert", ip, op);
}


 Siebel Communications Server Administration Guide 
 Published: 23 June 2003