function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CalvinHobbesCalvinHobbes 

How to query custom share object?

Hey, I need to query Notes__c custom objects share object i.e. Notes__share to check which records have parentid and UserOrGroupId populated. how do I do that?

 

When i tried 

<List> nonNull = [select id,ParentId,UserOrGroupId from Notes_Share where UserOrGroupId != null and ParentId != null  ];

 

 

it did not allow me to save informing that Notes_share is not supported and Please reference your WSDL or the describe call for the appropriate names.

 

Any ideas?

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

Assuming you've pasted the error in verbatim, its because you have a single underscore between Notes and Share when it should be a double underscore.  E.g.

 

 

List<Notes__Share> nonNull = [select id,ParentId,UserOrGroupId from Notes__Share where UserOrGroupId != null and ParentId != null  ];

 

 

All Answers

bob_buzzardbob_buzzard

Assuming you've pasted the error in verbatim, its because you have a single underscore between Notes and Share when it should be a double underscore.  E.g.

 

 

List<Notes__Share> nonNull = [select id,ParentId,UserOrGroupId from Notes__Share where UserOrGroupId != null and ParentId != null  ];

 

 

This was selected as the best answer
CalvinHobbesCalvinHobbes

Hey Bob, Yeap you're correct, I corrected it :)

 

Thanks a lot. Silly me :smileyvery-happy: