In a community (napili) there is a button (global action on case) that allow users to create a new case and add an attachment to this case.

When I do that, it creates me a case, and an attachment to this case. But in the developper console, if I try to access this attachment with a query like this in the query editor, it found nothing :

SELECT Id, ContentDocument.title, ContentDocument.ContentModifiedDate, 
                                    ContentDocument.FileExtension, ContentDocument.ContentSize, 
                                    ContentDocument.FileType, ContentDocument.LatestPublishedVersionId
                                    FROM ContentDocumentLink WHERE LinkedEntityId ='5009E000007fay3QAA'

Also, if I add an attachment to a created case, via a lightning component with the tag lightning:fileUpload, when I try the query it works and retrieve the attachment.

Here is the attachment's list of a case, we can see that even if both are pdf, they are not display the same way : enter image description here

Moreover, when I click the attachment in the attachment's list of a case, when it is the case added with the community it did not display the file, it only download it. Conversely when I click the attachment create by the lightning component, it display it like this : enter image description here

I need to get the attachments list of a case when the case is created, but as I said the query retrieve nothing when the attachment is added at the creation of the case.

1 Answer 1


If thats an Attachment then your query will be

Select id,Name from Attachment where ParentID='5009E000007fay3QAA'

FileUpload doesnt create ContentDocument or ContentDocumentLink so you can just querry Attachment and get your job going.

  • I just try your query, and with it I can only get the attachment added with the community. It does not retrieve the file (or attachment ?) added with the lightning component via the tag lightning:fileUpload
    – dou
    Commented May 16, 2018 at 13:30
  • Wouldn't it be better to use file instead of attachment ? It seems that when using the tag lightning:fileUpload it upload files, and when using the default uploading via the community it upload attachments...
    – dou
    Commented May 16, 2018 at 14:23
  • Candidate for IdeaExchange. Commented May 16, 2018 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .