Passing a Value Through a Reference
Siebel eScript can pass a variable to a subroutine or a function through a reference. However, you use a variable to pass a value for most methods. Each method determines if it can receive a value from a variable or a reference.
A subroutine or function can modify the value. The following example includes this configuration:
var VariableA = new Object;
VariableA.name = "Joe";
VariableA.old = ReturnName(VariableA)
function ReturnName(VariableB)
{
var VariableC = VariableB.name;
VariableB.name = “Vijay”;
return VariableC
}
The following occurs in this example:
Siebel eScript passes VariableA to the ReturnName function through a reference.
VariableB receives a reference to the object, but it does not receive a copy of this object.
VariableB can reference every property and method of VariableA.
The ReturnName function modifies the value in VariableB.name to Vijay. The value in VariableA.name also becomes Vijay.
The Return statement passes a value back to the function that calls it. Siebel CRM does not run any code in a function that follows the Return statement. For more information, see Return Statement of a Function Object.