List box value management with scripts

To help you write your scripts, a sample script has been provided. You can view the sample script called browserInfo.js at CHANGE_APP_HOME/WEB-INF/wsconfig/scripts/listbox.

The script is written in JavaScript. The script shows how to access context variables, such as the list box attribute name, ancestors in the dependency chain, and so on, that are passed to it and how to return results.

Information is passed to the script using the pre-defined variables. The following variable names are reserved and cannot be redefined by the script writer.

Table 1. Variable names
Reserved Variable Type Contents
ancestors Map Name and value information for parent, grandparent, and so on
attributeName String Attribute name for which values are to be retrieved
database String Database path to which the user is currently connected
formType String Type of form the attribute is on. If the attribute is QUERY, then all results are returned.
listboxDefault String Default list box value. For example, Any.
log ScriptLogger, which has the logMessage(string) method and the logMessage(Throwable) method Allows the script to print to the event log
results List of Strings (starts empty) Where the results of the script go
userGroups List of strings List of groups of which the user is a member
userName String Name of user trying to get the list box values
Note: External list box scripts are run at the time the user interacts with the corresponding list box (that is, on demand). This action has two ramifications:
  1. The script must run quickly. Otherwise the user must wait while the list box loads.
  2. CR dialogs containing external list boxes might potentially load faster than regular list boxes because the list box values are not retrieved unless needed.

Feedback