9 Using Scripting for User Cache Queries
Job and case management triggers often need to convert user IDs to user names and extract user attributes such as emails. EDQ 12.2.1.4.4 provides a script library with functions for user cache and user query. This chapter describes how to use the script library.
To use the library, add this line to the top of the script:
addLibrary("usercache")
The library publishes an object named usercache in the script, which includes the following functions:
Name | Description |
---|---|
user = usercache.getUser(id) |
Map a numeric ID to a user object. Return |
user = usercache.getLiveUser(id) |
Map a numeric ID to an existing user. Users recorded as deleted are not returned. |
user = usercache.lookup(username, [withid]) |
Lookup a user by username by searching all configured realms. If |
user = usercache.lookupInRealm(username, realm, [withid]) |
Lookup a user by username in a single realm. Use |
The user object returned by these method has the following read-only properties:
Property | Description |
---|---|
id |
Internal ID of the user. The user with ID 0 is the special "system user". |
userName |
The user name. |
displayName |
User display name. Defaults to user identity. |
realm |
The user realm. |
identity |
The internal user identity - username@realm. |
fullName |
The user's full name. |
emailAddress |
The user's email address. |
organization |
The user's organization string. |
groups |
Array of strings representing the user's group membership. |