Issue with Closures/Lexical Scoping in eScript

(Doc ID 1931696.1)

Last updated on OCTOBER 09, 2014

Applies to:

Siebel CRM - Version 8.2.2 SIA[22320] and later
Information in this document applies to any platform.


I am writing Business Services that create custom objects in eScript, and I wish to create "instance variables" that can not be accessed from outside the object.

The BS tested contains the following scripts:
- - -
function Service_PreInvokeMethod(MethodName, Inputs, Outputs)
var a = createClosure();
- - -
function createClosure()
var a = function()
  var b = "test";
getName: function() {return b;}
return a();
- - -

When calling createTestClosure(), I am able to retrieve a newly created object.

a.displayName(); fails however and I get an error message saying that "b" is not defined.

However, as eScript is a variant of ecma script, it should be possible to use lexical scoping in order to access the variable b from the literal function getName.


Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms