1

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
Karthick

2 Answers 2

0

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;
2
  • there is no ContentDocument.LatestPublishedVersionId in Contentversion class Apr 6, 2015 at 17:35
  • try to use through ContentDocumentId (this field must be in ContentVersion) and another one query
    – misha_m
    Apr 6, 2015 at 17:44
0

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.

https://www.salesforce.com/developer/docs/api/Content/sforce_api_erd_content.htm#sforce_api_erd_content

You must log in to answer this question.

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