Using Siebel Tools > Using Siebel Script Editors > Using the ST eScript Engine >
Overview of Using the ST eScript Engine
The following versions of the Siebel eScript Engine are available:
- ST eScript Engine. Available with Siebel CRM version 7.8 and higher. The ST eScript Engine is the default Siebel eScript Engine in version 8.0.
- T eScript Engine. Available before Siebel CRM version 7.8.
It is recommended that you use the ST eScript Engine. Starting with Siebel CRM version 8.0, you can use only the ST eScript Engine. Except for a few differences, the ST eScript Engine is compatible with script that you create with the T eScript Engine. This document refers to each engine by name only if it describes a difference in functionality between the ST eScript Engine and the T eScript Engine. The ST eScript Engine is compliant with the ECMAScript Edition 4 standard. ECMAScript is the implementation of JavaScript as defined by the ECMA -262 standard. The ST eScript Engine includes the following capabilities:
- Performance. Provides higher throughput with a lower CPU and memory footprint in situations where you use a significant amount of script. The result is improved performance and lower maintenance on heavily scripted events.
- Scalability. If many users concurrently run scripts, then the performance of the ST eScript Engine is superior to the performance of the T eScript Engine.
- Strong typing. Supports strong typing that is compliant with the ECMAScript Edition 4 standard. Strongly typed objects result in scripts that are more functional and improved performance. The T eScript Engine does not support strong typing.
- Functionality. Adds new functionality, such as Script Assist, script libraries, favorites, and Fix and Go. For more information, see About Script Assist and Using Fix and Go.
For more information, see Siebel eScript Language Reference. About ST eScript Engine Warnings
The ST eScript Engine can display warnings that notify you of the following potential problems that might occur if you compile your custom script:
- Referencing a method or property that is not predefined
- Referencing an undeclared identifier
- Using a variable before it initializes this variable
- Using a redundant declaration of an untyped variable
- Calling a function that includes an insufficient number of arguments
These errors might cause a run-time failure. You can use these warnings to help fix errors before you compile your script. To enable or disable the Enable Warnings option, see Setting Options for the ST eScript Engine. Example of a Warning Message
The following code is an example of a compile warning message that Siebel Tools creates after a run-time failure: function foo(a) { var oApp: Application; oApp.myMethod (); return; } foo (); Semantic Warning around line 5:Variable oApp might not be initialized. Semantic Warning around line 5:No such method myMethod Semantic Warning around line 10:Calling function foo with insufficient number of arguments. Unhandled Exception: Function expected
How the ST eScript Engine Determines the Type of Variables That a Script Uses
Type deduction is a feature of the ST eScript Engine that determines the type of local variables that a script uses. It scans the assignments that the script makes to each local variable. If the ST eScript Engine can successfully determine the type for all local variables, then the compiler performs strict type checks and creates statically bound code that runs faster and uses less memory. This configuration might introduce more compile warnings as a result of performing these type checks. It cannot determine the type in all situations. It is recommended that you type your script. To enable or disable type deduction, see Setting Options for the ST eScript Engine. Example of a Script That Deduces the Local Variable Type
The following script deduces the type of the oDate local variable to the Date. It then creates a warning about the MyMethod method. This method is not defined. This script fails at run time: function goo() { var oDate; oDate = new Date () oDate.myMethod (); return; } goo () Semantic Warning around line 19:No such method myMethod Unhandled Exception: 'myMethod' is not defined
About Script Assist
Script Assist is part of the ST eScript Engine. To help you develop a script, it inspects object definitions, and then makes information about these object definitions available to you. It includes the following functionality:
- Syntax highlight. Uses color to highlight reserved words, data types, operators, and other syntax in Siebel VB and Siebel eScript script. You cannot modify these colors. The following table lists the colors that it uses:
|
|
Reserved word or Siebel VB statement. |
Blue |
Data type. |
OrangeRed |
Operator. |
Navy |
String literal. |
SteelBlue |
Delimiter. For Siebel eScript only. |
Brown |
Function. For Siebel VB only. |
Magenta |
- Method list. Displays a list of methods and properties that are available for an object. For more information, see Icons That the Script Assist Window Contains.
- Repository inspection. Inspects objects and object types in the repository without requiring you to type a string literal. This functionality results in fewer mistakes in your script. It also understands predefined constants for a business component method.
- Favorites. Uses italics to indicate the most frequently used object, method, or property name in the Script Assist window. Favorites exist for only a single Siebel Tools session. When you log out of Siebel Tools, it clears these favorites. If you create a new function, then you must add it to the declarations, and then save the script modifications. If you do not do this, then Siebel Tools does not display the function as a favorite.
- Script libraries. Allows you to call a business service function after you declare the business service. You do not declare property sets or make an InvokeMethod call. A script library helps you develop code that is reusable and modular. For more information, see Using Script Libraries with the ST eScript Engine.
- Auto complete. Automatically completes an entry after you enter a minimum number of unique characters in the Script Assist window. For example, if you enter
Bus , then Siebel Tools automatically enters the word BusComp .
- Auto indent. Maintains a running indent. If you press the Return key or the Enter key, then it inserts spaces and tabs that left-justifies the code.
- Tool tips. Allows you to view descriptions of the method arguments that you use.
- Includes child scripts. Script Assist can parse a script that you write on a business component, applet, or business service. You can use the Application drop-down list to choose the Siebel application that includes the child script. Script Assist displays the scripts that are written on this application object in the Script Assist window.
- Includes scripts you write in the general section. A script that you write in the general section of the script explorer window is available in the Script Assist window. For example, if you write a helper function named Helper in the general section of the current script, and if you start Script Assist, then it includes Helper in a pop-up window.
Using Script Assist with a Custom Siebel eScript Method
If a script references a custom Siebel eScript method on a business component, and if this script does not reside on the same business component that includes this custom method, then Script Assist does not recognize the custom method and cannot display data from it. For example, you create a business component method named MyMethod on the Account business component. You then create a script on the Contact business component that references the MyMethod method. In this example, Script Assist does not include any information about your custom MyMethod method. Icons That the Script Assist Window Contains
Table 11 describes the methods and properties that the Script Assist window shows when you choose an object. For more information, see Opening the Script Assist Window.
Table 11. Icons That the Script Assist Window Contains
|
|
|
Read-only property |
|
Modifiable property |
|
Method |
|
Class object |
|
Primitive |
|