+ Start a Discussion
Suman MSuman M 

How to query on FeedComment as a Non System Admin User


We have a functionality where users post on discussions on a community, in the backend we have Discussions as a Custom object, in this we are taking the Count of Posts made by users on the discussions records.
in the apex class, we are querying on FeedComment to get the count.
Now when a community user logs into community, they are able to post on a Discussion, but they are not able to delete the post that they posted previously. An exception is thrown from rhe Apex class. below is the error msg.

User-added image

Please suggest if there is any workapund for this. Thank You.
ShashankShashank (Salesforce Developers) 
FeedComment object can be directly queried only by users who have "View All Data" permission on their profiles. You may want to try changing the version of the apex class to 22.0 or below, if it is okay.