GetSharedGlobal Method for an Application

The GetSharedGlobal method returns the shared global variables. A shared variable is a type of variable that any script in the user session can access. It is shared among all scripts.

A shared global variable is unique to the user and the user session. A global variable for a given user is not visible to any other user. A global variable is visible only to the current user and user session. You can access the global variable from any event.

Format

Application.GetSharedGlobal(varName)

The following table describes the arguments for the GetSharedGlobal method.

Argument Description

varName

String literal or variable that contains the name of the global variable.

Usage

Consider the following code:

GetSharedGlobal("varName")

This code returns the string that the following code sets:

SetSharedGlobal "varName", "stringValue".

Used With

COM Data Control, COM Data Server, Mobile Web Client Automation Server, Server Script

Example of Using the GetSharedGlobal Method

To get the myGlobalVar global variable, the examples in this topic call the GetSharedGlobal method in the BusComp_WriteRecord event. This global variable is set through the SetSharedGlobal method in the Application_Start event. For more information, see SetSharedGlobal Method for an Application.

The following example is for the Component Object Model (COM):

Dim sReturn as String
oleVar = SiebelApplication.GetSharedGlobal("myGlobalVar", errCode)
SiebelApplication.SetSharedGlobal "myGlobalVar", " helloworld", errCode

The following example is in Siebel eScript:

function Application_Start (CommandLine)
{
   TheApplication().SetSharedGlobal("myGlobalVar", "helloworld");
}

function BusComp_WriteRecord ()
{
   var myVar;
   myVar = TheApplication().GetSharedGlobal("myGlobalVar");
}

The following example is in Siebel VB:

Sub Application_Start (CommandLine As String)
   TheApplication.SetSharedGlobal "myGlobalVar", "helloworld"
End Sub

Sub BusComp_WriteRecord
   Dim myVar as String
   myVar = TheApplication.GetSharedGlobal("myGlobalVar")
End Sub