JavaScript Extensions

One additional object is accessible through JavaScript or substitution when running on the Server. It provides a few utility functions related to user access, for example so you can include the name of the user who generated a report as part of the report itself.

The object is called Server and provides the following functions:

int getUserId()
Returns the unique id of the current user
String getUserName()
Returns the name of the current user
int[] getGroupIds()
Returns the ids of the groups to which the current user belongs
String[] getGroupNames()
Returns the names of the groups to which the current user belongs
boolean isAdmin()
Returns true if the current user belongs to the admin group
String getRepositoryUserHome()
Returns the name of the current user's repository home directory

The Server object can be used in any server-side JavaScript codes but will be undefined if used in the standalone Designer. Substitutions can use the Server object by invoking JavaScript through an "=" prefix. For example

${=Server.getUserName()}

will insert the current user name into the output.