+ 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