0

I am currently using Change Data Capture, to subscribe to the ContentVersion change event. Because in my Lightning Web Component (LWC), I am required to automatically refresh the files list once a file is deleted/uploaded.

Hence I am using CDC to listen to ContentVersion change event. Everything is working as expected, when I am testing as System Administrator, however, when I changed to a different profile, it is not working as expected and I get the following error:

Received error from server: {"clientId":"123","channel":"/meta/subscribe","id":"6", "subscription":"/data/ContentVersionChangeEvent", "error":"403::User not allowed to subscribe CDC without required permissions", "successful":false} 

*I have changed the clientId to shorten the error.

The documentation (Required Permissions for Change Event Subscriber) states, this permission is needed

View All Records for the object

However, I could not find this permission on Files object, when I view the Profile Object Settings. There's only Tab Settings (Tab Hidden, Default Off and Default On). I have tried setting the this setting to 'Default On' but still getting the same error.

Has anyone faced this before and/or got a solution please?

Many thanks for your help and valuable time!

2
  • 2
    Do you have checked this? - help.salesforce.com/s/… - help.salesforce.com/s/articleView?id=000381258&type=1 Commented Mar 10 at 6:43
  • @TusharJadav Thanks that seems to solve it and indeed is the solution. However I have changed the implementation to use Platform Event, where I can control the permission more accurately instead of giving 'View All'. You can post that as answer and I will accept it, many thanks once again for your valuable time and help! Commented Mar 12 at 6:18

1 Answer 1

0

As per the documentation,

With the new Query All Files permission, View All Data users can query ContentDocument and ContentVersion and retrieve all files in the org, including files in non-member libraries and files in unlisted groups. On its own, the View All Data permission only allows you to query files you own or have access to.

How: Enable the profile permission under System Permissions and App Permissions in Setup.

Query All Files: With the Query All Files permission, View All Data users can query ContentDocument and ContentVersion and retrieve all files in the org, including files in non-member libraries and files in unlisted group.

Note: This change applies to Lightning Experience and Salesforce Classic in Professional, Enterprise, Performance, and Unlimited editions. This permission does not grant access to History objects ContentDocumentHistory and ContentVersionHistory.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.