Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Apex Interactions

Each record in your package usage log that has a custom_entity_type of ApexClass or ApexTrigger describes an interaction with your packaged Apex class or trigger.
Available in: both Salesforce Classic and Lightning Experience
Available in: Enterprise, Performance, Unlimited, and Developer Editions

Apex Execution

When log_record_type is ApexExecution, the log record is associated with a user action that resulted in the execution of Apex code from an Apex class or trigger. Only the outermost Apex is captured.

Standard Data Supplemental Data
  • entry_point
  • quiddity
num_soql_queries

Apex Unexpected Exception

When log_record_type is ApexUnexpectedException, the log record is associated with a user action that resulted in an Apex class or trigger throwing an unhandled exception. The stack_trace field provides detail about the Apex unexpected exceptions.

Standard Data Supplemental Data
stack_trace none

Example

Let’s look at an example package usage log record and analyze the Apex interaction.

1{
2     "timestamp_derived": "2022-11-22T06:19:33.990Z",
3     "log_record_type": "ApexExecution",
4     "request_id": "4mbhxFWBBXz83tlq2Z5aAk",
5     "organization_id": "00Dxx0000006H2l",
6     "organization_name": "MyCustomer Inc.",
7     "organization_status": "Demo",
8     "organization_edition": "Enterprise Edition",
9     "organization_country_code": "IN",
10     "organization_language_locale": "en_US",
11     "organization_time_zone": "Australia/Sydney",
12     "organization_instance": "GS0",
13     "organization_type": "Production",
14     "user_id_token": "005-9BwnBWYO5FMn4cZ1sLw7F3LmTpoe8M77GrZOZHL6xQk=",
15     "user_type": "Standard",
16     "package_id": "033xx0000004FqD",
17     "package_version_id": "04txx0000004Idi",
18     "managed_package_namespace": "Acme",
19     "custom_entity": "InsuranceDetailsBatchable",
20     "custom_entity_type": "ApexClass",
21     "session_key": "2l4YtFB/RmsRKVsS",
22     "login_key": "fGV6RgVOH3ZCgl2v",
23     "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/IP_ADDRESS_REMOVED Safari/537.36",
24     "user_country_code": "US",
25     "user_time_zone": "America/Los_Angeles",
26     "entry_point": "Acme.InsuranceDetailsBatchable",
27     "num_soql_queries": "2",
28     "quiddity": "A"
29}

The InsuranceAgentDetailsBatchable packaged component of type ApexClass was interacted with as a result of a user action from subscriber org MyCustomer Inc. Specifically, an execution of a batch Apex job occurred on 2022-11-22 at 6:19 am. The batch Apex job is represented by Quiddity = A.

The key data in this analysis are:

Question Field Value
What
  • custom_entity
  • custom_entity_type
  • package_version_id
  • managed_package_namespace
  • InsuranceDetailsBatchable
  • ApexClass
  • 04txx0000004Idi
  • Admc
Who
  • organization_id
  • user_id_token
  • 00Dxx0000006H2l
  • 005-9BwnBWYO5FMn4cZ1sLw7F3LmTpoe8M77GrZOZHL6xQk=
How
  • log_record_type
  • quiddity
  • ApexExecution
  • A
When timestamp_derived 2022-11-22T06:19:33.990Z