Bookshelf Home | Contents | Index | PDF |
Siebel eScript Language Reference > Using Siebel eScript > Coding with Siebel eScript > Declaring and Using VariablesA variable is an object that stores and represents information in a script. Siebel eScript can modify the value of a variable but it cannot modify the value of a literal. For example, to display a name literally, you must use the following code multiple times: TheApplication().RaiseErrorText("Aloysius Gloucestershire Merkowitzky"); To simplify this code, the following code uses a variable: var Name = "Aloysius Gloucestershire Merkowitzy"; The value of the Name variable changes, which allows you to use shorter lines of code and to reuse the same lines of code. About Local and Global VariablesSiebel eScript includes the following types of variables:
If you declare a local variable that uses the same name as a global variable, then you cannot reference this global variable from the function where you declare this local variable. Siebel VB includes a Global statement. You cannot use this statement in Siebel eScript. Declaring a Global Variable Outside of a FunctionYou can write code that declares a variable in a location other than in the declaration section. For example: Using a Local Variable Is Preferable to Using a Global VariableIt is recommended that you use a local variable where possible instead of a global variable for the following reasons:
Instead of using a global variable, it is recommended that you configure Siebel CRM to pass an object as a parameter to a function so that you can control the scope of the parameter. If you are considering using a global variable, then you must consider this usage carefully. If you use a global variable, then do so only rarely and document it thoroughly. Example of Declaring Local and Global VariablesThe following example includes local and global variables: var globalVariable = 1; This example illustrates the following concepts:
The following code includes variables that are available to Function1 and Function2: Function1(): globalVariable, localVariable1, localVariable2 Declaring a VariableThis topic describes how to declare a variable. You can write code that saves a value in a variable when you declare it. For example: Declaring a Variable In a Statement BlockIf you declare a variable in a statement block in a method, then you can reference this variable anywhere in the method, including from a statement block that resides in the method where you did not declare the variable. |
Siebel eScript Language Reference | Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |