alexed1 / LightningFlowComponents

A collection of unofficial Flow extensions that can be used to enhance Salesforce Flow and Orchestrator.
http://unofficialsf.com
Other
585 stars 575 forks source link

*QuickChoiceFSC* - getPicklistValues wire service - Accessing {getPicklistValues} from "lightning/uiObjectInfoApi" #564

Open RealEvanPonter opened 3 years ago

RealEvanPonter commented 3 years ago

I am attempting to use a QuickChoice component on a screen flow that is being distributed on a community page to an unauthenticated Guest User. I set the flow to run in "System Context Without Sharing--Access All Data". The QuickChoice component is configured to display a Picklist using a Picklist field as the data source. I've selected an object and a field. Upon testing this flow, no picklist choices are visible. The console in the browser inspector shows:

getPicklistValues wire service returned error: {"status":403,"body":{"message":"You don't have access to this record. Ask your administrator for help or to request access.","statusCode":403,"errorCode":"INSUFFICIENT_ACCESS"},"headers":{}}

Within the source code for fsc_quickChoiceFSC.js I see: import {getPicklistValues} from "lightning/uiObjectInfoApi"; Which seems to be accessing a function via the User Interface API from the Lightning Data Service (LDS).

If I grant the Guest User profile Read access to the object and Read Access to the picklist field, then this QuickChoice component behaves as expected. I'm hoping I won't need to grant these permissions that so that tighter security can be enforced for this public community.

Please let me know if there's a better place to report this - I realize it might be something a different Salesforce team would handle, but wanted to start here in case there were any security settings or configurations that could be altered in this code base to allow for accessing Lightning Data Service in the same context that the flow is configured to run in.

Steps to reproduce

Steps to reproduce the behavior:

  1. Install the FlowScreenComponentsBasePack v2.1.3 package
  2. Create a screen flow
  3. Set the "How to Run the Flow" setting to "System Context Without Sharing-Access All Data"
  4. Add a screen element to the canvas
  5. Add the QuickChoice element to the screen
  6. Configure the component to display choices from a picklist field on an object
  7. Save and activate the flow
  8. Create a community
  9. Allow guest users to access the community
  10. Ensure that the guest user profile has all the necessary permissions to run flows
  11. Add a flow element to a community page - select the flow created above
  12. Save and publish the community
  13. Navigate to the public webpage that display this flow

Expected behaviour

The QuickChoice component should display the picklist values from the selected field on the selected object

Actual behaviour

The QuickChoice component does not display any picklist values. An error can be seen in the console of the browser inspector:

'getPicklistValues wire service returned error: {"status":403,"body":{"message":"You don't have access to this record. Ask your administrator for help or to request access.","statusCode":403,"errorCode":"INSUFFICIENT_ACCESS"},"headers":{}}'

Screenshots

Flow property configuration image

QuickChoice component configuration image

Debug Logs

Debug Log Information `getPicklistValues wire service returned error: {"status":403,"body":{"message":"You don't have access to this record. Ask your administrator for help or to request access.","statusCode":403,"errorCode":"INSUFFICIENT_ACCESS"},"headers":{}}`
adwhite75 commented 3 years ago

@alexed1 I believe this is a limitation of LWC - not really sure what our options are. The same applies for any user that doesnt have access to the picklist values.

My other thought here would be to use GetPicklistValues and use that output to populate the QuickChoice values.