Siebel eScript Language Reference > Using Siebel eScript > Coding with Siebel eScript >

Using Script Libraries


The ST eScript engine provides business service script libraries that assist you with developing components that are reusable and modular, which simplifies upgrades and maintenances. You can use script libraries to call global scripts. Script libraries provide the following capabilities:

  • Allows you to write code that calls a business service function directly from anywhere in the scripting interface after you declare the business service. You are not required to write code that declares property sets or issue InvokeMethod calls.
  • Allows you to write strongly typed methods for predefined business services. You can then use the Script Assist utility to write code that calls these business services. For more information, see Using Strongly Typed and Typeless Variables.

Using script libraries is optional. Siebel CRM supports all code written prior to Siebel 8.0.

Example of Calling a Business Service Function

The following example calls a method directly on the Data Transfer Service without declaring a property set. Calling a business service method directly results in scripts that are shorter and more readable:

var oBS : Service = TheApplication ().GetService ("Data Transfer Service");
oBS.SendData ("Name", "John Doe");

Example of a Creating Custom Method for a Business Service

You can write a custom method for a business service and make it available in Script Assist. The following example creates SendData, which is a custom wrapper method that resides on the Data Transfer Service:

function SendData (sTag : String, sValue : String)
{
var oPS1 = TheApplication ().NewPropertySet ();
var oPS2 = TheApplication ().NewPropertySet ();

oPS1.SetProperty ("Tag", sTag);
oPS1.SetProperty ("Value", sValue);

this.InvokeMethod ("SendData", oPS1, oPS2)
}

You can write code that intercepts and modifies the calls to the Data Transfer Service in a central location in the SendData method.

Displaying a Custom Method in Script Assist

This topic describes how to display a custom method in Script Assist. For more information, see About the Script Assist Utility. For more information about setting an object property or about using the Server Script Editor to create, save, or compile a script, see Using Siebel Tools.

To display a custom method in Script Assist

  1. Make a custom method available to the script libraries so that you can call it from Script Assist:
    1. Save the business service method script.
    2. Make sure the script does not contain compile errors.

      If a script library calls a function, then the compiler determines if argument types are valid and do not contain incompatibilities.

    3. In Siebel Tools, make sure the External Use property contains a check mark for the business service object.
  2. To access Script Assist from the script editor, press CTRL + SPACE.
  3. In your script, enter the name of a business service object followed by a period (.).

    Script Assist displays the default and custom scripted methods that are available for the business service object.

  4. Choose the method you must add to your script.
Siebel eScript Language Reference Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.