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
Kailas MahajanKailas Mahajan 

Need help on to get the ContentDocument Id from my apex class/trigger: 1) I have created document using ContentVersion - but here the owner is Guest user (this is created in Salesforce as a separate site user)

Hi
I need help on to get the ContentDocument Id from my apex class/TRIGGER and my scenario is as below:
 
1) I have created document using ContentVersion - but here the owner is Guest user (this is created in Salesforce as a separate site user)
2) Document is created successfully, and now I want to link this with my object
3) But when I am trying to access document Id from ContentVersion using SOQL (from apex class and Trigger) I did not get any rows.
 
Can anyone help me which is exact location to fire query to link the document with object (I know about object Id should have to assign to "LinkedId" of ContentDocumentLink)
 
Feel free to get back to me if you need any additional information.
 
Thank you,
Kailas