2

This could be a general Developer Console issue as well, but as of now it pertains to the ContentNote object.

I am trying to run a query in an apex class that will looks at related Content Notes on Opportunities. The problem I am running into, is that myself and other users cannot see the ContentNotes. In the developer console query I can only see ContentNotes created by myself (Select id From ContentNote). However if I explicitly put a WHERE clause with an Id, I can see that record in the dev console (Select id From ContentNote WHERE id = 'xxxxxxxxxxx').

When I queried for the SharingPrivacy of the ContentNote I get "N" for all of them - the ones I can only see when I specify an ID. I also have a trigger that is setting the Visibility field of ContentDocumentLink to 'AllUsers' so that record shouldn't be the problem.

Is there anything else that could be blocking me from querying the ContentNote records?

  • I can also see all AttachedContentNotes (SELECT Id, Name, (SELECT Id FROM AttachedContentNotes) FROM Opportunity) without having to specify an ID, but that isn't the solution to my problem

  • The parent object - Opportunity has sharing settings set to Private, however as the system admin, I can query all opportunities.

  • The ContentNotes have the message 'Visibility Set by Record'
2
  • 1
    Are you able to navigate to the detail pages for ContentNote records that you don't own? Commented Dec 19, 2019 at 19:53
  • 1
    @Brand0R, yes I can type the Id into the URL and view the record detail page Commented Dec 19, 2019 at 19:58

1 Answer 1

2

If the ConentNotes records you're attempting to query reside under Libraries that are marked as 'Private' this could be the issue. Private libraries cannot be accessed by System Admins. They can only be Accessed by library owners.

This came from the developer forums where someone asked a similar question here.

Additionally, you can check the sharing settings that exist on parent records and ensure they aren't set to private.

3
  • 1
    They are not in Libraries, but you did make me check the sharing settings on the parent record which are set to private. Updating my original post Commented Dec 19, 2019 at 20:10
  • 1
    I updated my solution to include that as a suggestion. Commented Dec 19, 2019 at 20:14
  • So I'm guessing that would be the problem. Is there a workaround or will I simply have to query individual Ids to see the notes? Commented Dec 19, 2019 at 21:17

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.