Skip to content

Add overloads to Logger.logDatabaseErrors() to accept List<SObject> #942

@jongpie

Description

@jongpie

Currently, there are several overloads for Logger.logDatabaseErrors() to log only error instances of any of the various Database result classes. But the result classes themselves don't have any info about the actual record, other than possibly the record ID (which will be blank on insert).

To help give more context to the Database results, there should be overrides for Logger.logDatabaseErrors() to pass in the list of SObject records

  • Assumption: the list of results & the list of records will be the same size & order (e.g., results[0] will be for records[0], etc.)
  • For each error result, find the matching record with the same index --> add it to a separate (temp) list
    • This is very similar to what's already done for any error results - only results with errors are added to a separate list resultsToLog, which is internally passed to setDatabaseResult().
  • Pass the list of matching records to setRecord() (alongside the existing call to setDatabaseResult()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Layer: Log ManagementItems related to the custom objects & Logger Console appLayer: Logger EngineItems related to the core logging engineLogging Source: ApexItems related to using Logger within ApexSalesforce Feature: ReportingAnything related to reports, dashboards, and the underlying data modelType: EnhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions