Siebel Object Interfaces Reference > Using Siebel Visual Basic and Siebel eScript > Configuring Error Handling >

Declaring a Variable


This topic describes how to declare a variable.

Declaring a Local Variable

This topic describes how to declare a local variable. You can access the value of a local variable only in the script where you define the local variable.

To declare a local variable

  1. Open the Siebel Script Editor.

    For more information, see Opening the Siebel Script Editor.

  2. In the navigation tree of the script editing window, expand the object tree, and then click the script you must modify.

    For example, expand the WebApplet tree, and then click WebApplet_PreInvokeMethod.

  3. In the script editing window, use one of the following statements in your custom script:
    • In Siebel VB, use the Dim statement.
    • In Siebel eScript, use the Var statement.
Example of Declaring a Local Variable in Siebel VB

The following example declares a local variable in Siebel VB:

Sub WebApplet_Load
   Dim localStr As String
End Sub

Example of Declaring a Local Variable in Siebel eScript

The following example declares a local variable in Siebel eScript:

function WebApplet_Load ()
{
   var localStr;
}

Declaring a Module Variable

This topic describes how to declare a module variable. In this situation, a module is a group of methods contained in an object that you can script. For example, a business service, business component, application object, and so forth. You can access the value of a module variable in the script where you define the module variable and in other scripts in the object or module where you define the module variable. To access a module variable, an instance of the object where you define the variable must exist.

To declare a module variable

  1. Open the Siebel Script Editor.

    For more information, see Opening the Siebel Script Editor.

  2. In the navigation tree of the script editing window, expand the general tree, and then click declarations.
  3. In the script editing window, use one of the following statements in your custom script:
    • In Siebel VB, use the Dim statement.
    • In Siebel eScript, use the Var statement.

The following example declares a module variable in Siebel VB:

(general)
(declarations)
Dim ContactId as String

Declaring a Global Variable

This topic describes how to declare a global variable.

To declare a global variable

  1. Open the Siebel Script Editor for the object you must modify.

    For more information, see Opening the Siebel Script Editor.

  2. Use the Global statement to declare the variable.

    The following example includes the Global statement in Siebel eScript:

    TheApplication().gVar = "some value";

  3. Repeat Step 1 and Step 2 for each object that must access the value of the global variable.
Do Not Use a Global Variable to Reference a Siebel Object

Do not use a global variable to reference a Siebel object, such as a business component or business object. If you must reference a Siebel object, then set the global variable to Nothing when you no longer require the object, or in the Application_Close event.

If you do not set the variable to Nothing, then a memory problem might occur. Siebel CRM cannot release from memory the object that the global variable references until the variable no longer references the object. If you must create a global variable for a business component, then make sure a global variable for the business object exists.

For more information, see Application_Close Event.

Siebel Object Interfaces Reference Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.