pegros / PEG_LIST

Set of configurable/actionable LWC list components for Salesforce Lightning UX
MIT License
20 stars 9 forks source link

[bug] sfpegList_CTL - AggregateResult SObject types are not supported #52

Open Mchaouche opened 1 year ago

Mchaouche commented 1 year ago

Describe the bug In the sfpegList cmp when we define a SOQL query with AggregateResult and don't bypassFLS in the MDT record, an exception is thrown in the Apex class sfpegList_CTL

To Reproduce Steps to reproduce the behavior:

  1. Go to CMT record
  2. Put a SOQL query with a count for example 3-FATAL_ERROR| System.AuraHandledException: Script-thrown exception is thrown

Expected behavior The list is shown

Additional context

The error is thrown in line 556: SObjectAccessDecision securityDecision = Security.stripInaccessible(AccessType.READABLE, results);

pegros commented 1 year ago

@Mchaouche Why cannot you simply bypass FLS for this query ? I would not understand why you would not display all aggregation dimensions in the results, as it would result in possible duplicate lines with same other aggregation values.

pegros commented 1 year ago

FYI @jstukas

Mchaouche commented 1 year ago

Hello @pegros Yes this is what we've done but i think the code should handle this exception, this is why i logged this issue to let you know, if you did not.

Thanks

pegros commented 1 year ago

I may catch the exception but would then probably return an empty list in such a case. @Mchaouche

pegros commented 9 months ago

FYI, a custom permission may be set on the sfpegList configuration to control who actually has access to the query with bypassFLS activated.