Can anyone tell me how to get the id of the feedItem files?
Like I want to know the id(ContentDocument.LatestPublishedVersionId) of the files that are attached to the feeditem and feedcomment.
Please someone give me the soql for above usecase.

Thanks in advance


I think this chain of queries can help you

String feedItemId = '...';
FeedItem feedItem = [
    SELECT RelatedRecordId
    FROM FeedItem
    WHERE Id = :feedItemId

String relatedRecordId = feedItem.RelatedRecordId;

ContentVersion version = [
    SELECT ContentDocument.LatestPublishedVersionId 
    FROM ContentVersion
    WHERE Id = :relatedRecordId

String result = version.ContentDocument.LatestPublishedVersionId;
| improve this answer | |
  • there is no ContentDocument.LatestPublishedVersionId in Contentversion class – user3332076 Apr 6 '15 at 17:35
  • try to use through ContentDocumentId (this field must be in ContentVersion) and another one query – RasMisha Apr 6 '15 at 17:44

I think below link may help you to understand the flow of the content Document and content Version relationship.still your question is not clear to me so i can't help you to give proper query but you can refer this link.


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.