Skip to main content
Kinetic Community

Wrapper: context

 

 

Wrappers are preinitialized Java objects that provide easy access to  various settings within the bundle.  The context wrapper provides access to some of the Remedy server properties, and also some properties of the logged in user. This wrapper is available as the "context" variable.

Methods

getContextCopy()

Parameters:

Returns: String

Returns a copy of the ARServerUser object.  This is the Remedy API object that deals directly with the Remedy server.

getUserName()

Parameters:

Returns: String

Returns the username that the requester logged into the sytem with.

Example

Ron Requester

getServerName()

Parameters:

Returns: String

Returns the name of the Remedy server the application is logged into.

Example

serverx.company.com

getRpcPort()

Parameters:

Returns: int

Returns the RPC port the user logged into the Remedy server with.

Example

0

 

getTcpPort()

Parameters:

Returns: int

Returns the TCP port the user logged into the Remedy server with.  If the Remedy server uses PortMapper, then 0 will be returned.

Example

0

 

getImpersonatedUser()

Parameters:

Returns: String

The name of the Remedy user this context is impersonating.  null is returned if impersonation is not used.

Example

Ron Requester

 

userIsMemberOfGroup(String[] groupNames)

Parameters: String[] Array of group names to test

Returns: boolean

Returns true if the user belongs to any of the group names in the array, else false.

Example

if (context.userIsMemberOfGroup(new String[] { "KS_RQT_Manager", "KS_TSK_Manager" })) {
    <div>You are a manager</div>
} else {
    <div>You are not a manager</div>
}

userIsMemberOfGroup(String groupName)

Parameters: String A group name to test

Returns: boolean

Returns true if the user belongs to the named group, else false.

Example

if (context.userIsMemberOfGroup("KS_RQT_Manager")) {
    <div>Hello Request Manager</div>
    <a href="importantManagerLink1">Important Manager Link 1</a><br/>
    <a href="importantManagerLink2">Important Manager Link 2</a><br/>
}

userIsMemberOfGroupById(String[] groupIds)

Parameters: String[] Array of group ids to test

Returns: boolean

Returns true if the user belongs to any of the group ids in the array, else false.

Example

 

if (context.userIsMemberOfGroup(new String[] { "10350", "10381" })) {
    <div>You are a manager</div>
} else {
    <div>You are not a manager</div>
}

 

userIsMemberOfGroupById(String groupId)

Parameters: String[] Array of group ids to test

Returns: boolean

Returns true if the user belongs to any of the group ids in the array, else false.

Example

 

if (context.userIsMemberOfGroupById("10350")) {
    <div>Hello Request Manager</div>
    <a href="importantManagerLink1">Important Manager Link 1</a><br/>
    <a href="importantManagerLink2">Important Manager Link 2</a><br/>
}

 

 

 

translateToGroupNames(String groupIds)

Parameters: String A single group id, or a semi-colon separated list of group ids to translate to their corresponding group name(s)

Returns: String

Returns the single group name, or comma separated list of group names that correspond to the group id(s)

Example

String groupNames = context.translateToGroupNames("10350,10381");

Returns

"KS_RQT_Manager,KS_TSK_Manager"
 

translateToGroupNames(String[] groupIds)

Parameters: String[] An array of group ids

Returns: String

Returns a comma separated list of group names that correspond to the group ids

Example

String groupNames = context.translateToGroupNames(new String[] { "10350", "10381" });

Returns

"KS_RQT_Manager,KS_TSK_Manager"

 

isAdminUser()

Parameters:

Returns: boolean

Returns true if the user is a member of the Administrator group, else false.

Example

if (context.isAdminUser()) {
    <div>Hello Administrator</div>
    <a href="importantAdminLink1">Important Admin Link 1</a><br/>
    <a href="importantAdminLink2">Important Admin Link 2</a><br/>
}

getTimezoneOffset()

Parameters:

Returns: int The negative number of minutes offset from GMT.

Retrieves the user's timezone offset.  This value is the negative number of minutes from GMT.  So if the user's time zone is GMT -06:00, the value returned would be 360.  If the user's time zone is GMT +02:00, the value returned would be -120.

Example

int tzOffset = context.getTimezoneOffset();

Returns

setTimezoneOffset(int tzOffset)

Parameters: int

Returns:

Sets the timezone offset so Remedy Date/Time fields can be correctly converted to the user's timezone.  This value is the negative number of minutes from GMT.  So if the user's time zone is GMT -06:00, the value to set would be 360.  If the user's time zone is GMT +02:00, the value to set would be -120.

Example

context.setTimezoneOffset(360);