About Local and Global Variables

Siebel eScript includes the following types of variables:

  • Local. A variable that you declare in a function. You can write code that references a local variable only in the function where you declare the variable.

  • Global. A variable that you declare in one of the following ways:

    • Declare the variable outside of a function.

    • Declare the variable in the general declarations section of the application object.

    You can write code that references or modify a global variable from the following items:

    • Any function that is associated with the Siebel object for which you declare the variable.

    • Any object in a Siebel application where you declare the variable.

    • Another Siebel application.

    • If you declare a global variable outside of a function, then you can reference it from any object that resides in the Siebel application where you declare this variable. For more information, see the following.

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 Function

You can write code that declares a variable in a location other than in the declaration section. For example:

var global1 = 6;
function ABC()
{
   global1 = 8;
   global2 = 6;
}
var global2 = 8;