About Function Scope

A function is global. Siebel eScript can call it from anywhere in a script in the object where you declare it. The examples in this topic achieve the following results:

  • The code passes the 3 and 4 literals as parameters to the SumTwo function.

  • The SumTwo function includes corresponding a and b variables. These variables contain the literal values that Siebel eScript passes to the function.

Example of Calling a Function as a Function

The following example calls the SumTwo function:

function SumTwo(a, b)
{
   return (a + b)
}

TheApplication().RaiseErrorText(SumTwo(3, 4));

The following example uses a method of the global object to call the SumTwo function:

function SumTwo(a, b)
{
   return (a + b)
}

TheApplication().RaiseErrorText(global.SumTwo(3, 4));