function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SS KarthickSS Karthick 

getting id of feedItem files

Hi folks,
     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
VinojVinoj
Hi Karthick,

If you know the Id of the FeedItem you can get the Id of the related file using this SOQL query:

SELECT RelatedRecordId FROM FeedItem WHERE Id = '0D5i000001wzbqUCAQ'

Let me know if that works or if I misunderstood.
SS KarthickSS Karthick
@Vinoj,
      I wanna (ContentDocument.LatestPublishedVersionId) of the file that are attached to feedItem and feedComment


Thanks in advance
Karthick
VinojVinoj
Sorry! Would this work for you?
 
SELECT ContentDocument.LatestPublishedVersionId FROM ContentVersion WHERE Id In (SELECT RelatedRecordId FROM FeedItem WHERE Id = '0D5i000001wzbqUCAQ')

 
SS KarthickSS Karthick
@Vinoj: there is no contentDocument.LastestPublishVersionId in ContenVersion class