Try OpenEdge Now
skip to main content
ABL Reference
Handle Attributes and Methods Reference : SET-APPL-CONTEXT( ) method
 

SET-APPL-CONTEXT( ) method

Sets (and records) the application context for the current session in each connected audit-enabled database whose current audit policy has this audit event enabled. Application context provides meaningful information about the conditions under which an application audit event occurred.
This method returns a Base64 character string that specifies the universally unique identifier (UUID) of the primary index for all audit event records generated by this method for this application context. This UUID is recorded in all subsequent audit event records until you either clear this application context or set a different application context. The UUID is 22 characters in length (the two trailing Base64 pad characters are removed).
Return type: CHARACTER
Applies to: AUDIT-CONTROL system handle

Syntax

SET-APPL-CONTEXT ( event-context
[ , event-detail [ , audit-custom-detail ] ] )
event-context
A character expression that specifies the context for the audit event. The value of this expression cannot exceed 200 characters. You can also use this value as an alternate index for querying the audit event record.
If you specify the Unknown value (?), the AVM generates a run-time error.
event-detail
An optional character expression that specifies additional audit detail. The value of this expression cannot exceed 10,000 characters.
audit-custom-detail
An optional character expression that specifies additional user detail. The value of this expression cannot exceed 10,000 characters.
The UUID is saved as the APPL-CONTEXT-ID attribute value for each connected audit-enabled database.
There can be only one active application context per session at any one point in time. To set a different application context for the session, you can:
*Call the CLEAR-APPL-CONTEXT( ) method, to clear the current application context, and then call the SET-APPL-CONTEXT( ) method with the new application context.
*Call the SET-APPL-CONTEXT( ) method with the new application context. If there is an existing application context in effect, the AVM clears the existing application context before setting the new application context.
Calling this method generates an audit event, and creates an audit record for the event in all connected audit-enabled databases according to each database's current audit policy settings.
The following code fragment illustrates how to use the SET-APPL-CONTEXT( ) method:
DEFINE VARIABLE name AS CHARACTER NO-UNDO.
DEFINE VARIABLE id   AS CHARACTER NO-UNDO.
. . .
id = AUDIT-CONTROL:SET-APPL-CONTEXT("Payroll app", "fica calculation", name).
. . .
AUDIT-CONTROL:LOG-AUDIT-EVENT(34123, "payroll.fica.calc").
. . .
AUDIT-CONTROL:CLEAR-APPL-CONTEXT.

See also

APPL-CONTEXT-ID attribute, CLEAR-APPL-CONTEXT( ) method