Skip to content

Added More Fields on LogEntryEvent__e, Log__c, and LogEntry__c

Compare
Choose a tag to compare
@jongpie jongpie released this 05 Jun 21:54
· 73 commits to main since this release
36f7440

This release is focused on automatically capturing & storing some new data points (in a few different areas) that provide additional context for monitoring & reporting.

Core Unlocked Package Changes

Logging in Lightning Components: New "Browser Details" fields on LogEntry__c

  • Resolved #225 by updating the logger LWC (logEntryBuilder.js mostly) to capture details about the user's browser & screen. These details are automatically now stored in these new fields on LogEntryEvent__e and LogEntry__c:

    New Fields Source of Data
    LogEntryEvent__e.BrowserFormFactor__c and LogEntry__c.BrowserFormFactor__c The value of FORM_FACTOR, imported using import FORM_FACTOR from '@salesforce/client/formFactor';
    LogEntryEvent__e.BrowserLanguage__c and LogEntry__c.BrowserLanguage__c The value of window.navigator.language
    LogEntryEvent__e.BrowserScreenResolution__c and LogEntry__c.BrowserScreenResolution__c The value of window.screen.availWidth + ' x ' + window.screen.availHeight
    LogEntryEvent__e.BrowserUrl__c and LogEntry__c.BrowserUrl__c The value of window.location.href
    LogEntryEvent__e.BrowserUserAgent__c and LogEntry__c.BrowserUserAgent__c The value of window.navigator.userAgent
    LogEntryEvent__e.BrowserWindowResolution__c and LogEntry__c.BrowserWindowResolution__c The value of window.innerWidth + ' x ' + window.innerHeight

Logging in Flow: New Flow Metadata fields on LogEntry__c

  • Resolved #451 by capturing some additional details about the running Flow via the object FlowDefinitionView. These details are automatically now stored in these new fields:

    New Fields Source of Data
    LogEntry__c.FlowRecordTriggerType__c The value of FlowDefinitionView.RecordTriggerType
    LogEntry__c.FlowTriggerOrder__c The value of FlowDefinitionView.TriggerOrder
    LogEntry__c.FlowTriggerSObjectType__c The value of FlowDefinitionView.TriggerObjectOrEvent.QualifiedApiName

Organization Details: New & Deprecated fields on LogEntryEvent__e and Log__c

  • "Renamed" (by creating new fields) some fields on LogEntryEvent__e and Log__c to have a more consistent naming convention. Note that the old fields are still included in the core package and are still populated so that orgs have time to update any existing reporting, etc. Eventually, the old fields will be fully removed from the package.

    Field Change Source of Data
    Deprecated Log__c.ApiReleaseNumber__c and replaced it with Log__c.OrganizationReleaseNumber__c Retrieved via the optional callout to https://api.status.salesforce.com
    Deprecated Log__c.ApiReleaseVersion__c and replaced it with Log__c.OrganizationReleaseVersion__c Retrieved via the optional callout to https://api.status.salesforce.com
    Deprecated LogEntryEvent__e.ApiVersion__c and Log__c.ApiVersion__c and replaced them with LogEntryEvent__e.OrganizationApiVersion__c and Log__c.OrganizationApiVersion__c The value of Logger.getOrganizationVersion()
    Added new field Log__c.OrganizationLocation__c Retrieved via the optional callout to https://api.status.salesforce.com

Logger Engine Changes

  • Made some internal changes to the logger LWC so that the JavaScript code's approach more closely aligns with the Apex code's approach. This should not have any functional changes (hopefully 😅), this is just to try to provide a little more consistency within the codebase for approaching the same goal (logging) in 2 different languages (Apex & JavaScript).

    Item In Apex In JavaScript
    Object used to store in-memory logging data LogEntryEvent__e object ComponentLogEntry inner class in logEntryBuilder.js
    Internal method used to access/update in-memory logging data Instance method LogEntryEventBuilder.getLogEntryEvent() Instance method LogEntryEventBuilder.getComponentLogEntry() in logEntryBuilder.js

Bugfixes

  • Small bugfix for logging in Flow: Added an extra guard clause in the private instance method LogEntryHandler.setFlowDefinitionFields() to prevent a possible NullPointerException. Previously, the code assumed that when OriginLocation__c == 'Flow', then OriginLocation__c would be the API name of the logging Flow. However, this may not always be the case, especially since the invocable actions currently rely on admins/devs to provide the Flow's API name, which is inherently an imperfect approach - but there isn't currently a way in Apex or Flow to automatically determine the Flow's API name, so the new guard clause helps avoid an exception.

Installation Info

Core Unlocked Package - no namespace

Full Changelog: v4.10.5...v4.10.6