|Bookshelf Home | Contents | Index | PDF|
Declare your variables. Standard ECMAScript does not require that you declare variables. Variables are declared implicitly as soon as they are used. However, Siebel eScript requires you to declare variables with the
Pay attention to case. Be aware that Siebel eScript is case-sensitive. Therefore, if you instantiate an object using the variable name SiebelApp, for example, eScript does not find that object if the code references it as siebelapp or SIEBELAPP instead of SiebelApp. Case sensitivity also applies to method names and other parts of Siebel eScript.
Use four-digit years in dates. Siebel applications and the ECMA-262 Standard handle two-digit years differently. Siebel applications assume that a two-digit year refers to the appropriate year between 1950 and 2049. The ECMA-262 Standard assumes that a two-digit year refers to a year between 1900 and 1999, inclusive. If your scripts do not enforce four-digit date entry and use four-digit dates, your users may unintentionally enter the wrong century when performing a query or creating or updating a record.
(BusComp) methods GetFormattedFieldValue() and SetFormattedFieldValue() are examples of Y2K sensitivities in Siebel eScript that use two-digit dates. If you use these methods in a script, users requesting orders for the years from 00 to 02 may find that they have retrieved orders for the years 1900-1902 (probably an empty list), instead of 2000-2002, which was what they wanted.
If you use only four-digit dates in your programs, you will not have Y2K problems with your scripts. With the preceding example, you could use GetFieldValue() and SetFieldValue(), which require dates to be specified using the canonical Siebel format (MM/DD/YYYY), instead of GetFormattedFieldValue() and SetFormattedFieldValue().
The this object reference. The special object reference this is eScript shorthand for "the current object." You should use this in place of references to active business objects and components. For example, in a business component event handler, you should use this in place of ActiveBusComp, as shown in the following example:
function BusComp_PreQuery ()
Make effective use of the switch construct. The switch construct directs the program to choose among any number of alternatives you require, based on the value of a single variable. This is greatly preferable to a series of nested If statements because it simplifies code maintenance. It also improves performance, because the variable must be evaluated only once.
|Siebel eScript Language Reference|