2

I have a situation where I am trying to retrieve documents which were generated by DrawLoop and added to SFDC as Files. As the System Admin user, I can query for this data using the following query:

[Select Id, ContentDocumentId, ContentDocument.LatestPublishedVersionId from ContentDocumentLink where LinkedEntityId = 'a0t5C0000005Bk5QAE' and ContentDocument.Title = 'Decision Letter.pdf' order by SystemModstamp desc]

When I attempt to use this in Apex as a Server-Side controller to a Lightning Component, I am getting zero records returned while logged into our portal as a regular portal user. Is there a different/better way to get a ContentDocumentId if I am querying by parent id and document name?

For reference, the use case I'm looking to implement involves an administrative user clicking a DrawLoop button to generate and associate a PDF to a custom object. I am attempting to pull that document by using the code in this paste:

https://pastebin.com/YxK14ihc

The end result is a clickable URL for the user that has access to the document(i.e. I can't open this up).

Has anyone else had to fight with using Files in a portal before?

1
  • I'm having a similar situation with a force.com site. The most curious thing is that my site guest user can see the document links that are created via apex. but not by the standard button. You found out any solution to this problem?
    – user37586
    Commented Oct 2, 2017 at 10:44

0

You must log in to answer this question.

Browse other questions tagged .