Request Class

Contains methods to obtain the request ID and Quiddity value of the current Salesforce request.

System

Use the Request class to detect the current Apex context at runtime. The methods in the Request class obtain a unique request ID and the Quiddity value that represent the current Apex execution type. These values can also be used to correlate with debug and event logs.

  • The request ID represents an individual transaction, but may not be universally unique. The request ID is present in the debug logs that are triggered by the request.
  • The request ID and Quiddity values are the same as in the event log files of the Apex Execution event type used in Event Monitoring.

This example code shows how to obtain current Apex code context by retrieving the request ID and Quiddity value of the current request.

The following are methods for Request.

  • getCurrent()

    Returns the current Request object that contains the request ID and Quiddity value.

  • getQuiddity()

    Returns the Quiddity value of the current Request object.

  • getRequestId()

    Returns the request ID of the current Request object.

Returns the current Request object that contains the request ID and Quiddity value.

public static System.Request getCurrent()

Type: System.Request

Returns the Quiddity value of the current Request object.

public System.Quiddity getQuiddity()

Type: System.Quiddity

Uses the values from the Quiddity enum. This value identifies the type of execution event associated with the current request.

Returns the request ID of the current Request object.

public String getRequestId()

Type: String