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
IvanB@LMIvanB@LM 

Chatter context post to the comments

Hi, Experts - I need to know what field is used to store file name when a file is attached to a chatter comment. As in for posts - title field in object feeditem stores file attached to a post; thank you.
Best Answer chosen by Admin (Salesforce Developers) 
IvanB@LMIvanB@LM

Thanks very much. After upgrading my Eclipce I see the newer field. 

All Answers

Jia HuJia Hu

Attachment is stored in the ContentDocument and ContentVersion

 

check this:

ContentDocument a = [Select Id, Title, CreatedDate From ContentDocument Where Title = 'your file title in the comment'];
System.debug(' ----' + a);

IvanB@LMIvanB@LM
Thanks; question is: I wanted to pull off title name for comments, so your hard coded title name in query unfortuantely will not work in my case. Is there a link between feedcomment and ContentDocument ?
Jia HuJia Hu

In this case,

first, find the contentId from the FeedComment,

and then find the Title from ContentVersion

 

FeedComment fc = [Select Id, RelatedRecordId From FeedComment Where CommentType = 'ContentComment' limit 1 ];
System.debug( fc );
ContentVersion cv = [Select Id, Title From ContentVersion Where Id =: fc.RelatedRecordId ];
System.debug( cv );

IvanB@LMIvanB@LM

Thank you for post; however I do not see relatedrecordid field in object feedcomment Here are fields that I see: Select f.ParentId, f.IsDeleted, f.InsertedById, f.Id, f.FeedItemId, f.CreatedDate, f.CreatedById, f.CommentBody From FeedComment f

 

Runing select you posted I get:

Compile error at line 1 column 18
No such column 'RelatedRecordId' on entity 'FeedComment'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

 

Thanks for your help again.

Jia HuJia Hu

Document is here:

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_feedcomment.htm

 

Please check your API version, must be in Ver. 24

 

Attachment of Comment is a few feature from Spring'12.

IvanB@LMIvanB@LM
Today I refreshed a SB from production and after downloading metadata to Eclipse force.com IDE I still did not see that new field relatedrecordid in feedcomment. Is relatedrecordid already out or it is coming in the summer. Is API 24 for Spring 12 ? Appreciate info, thanks.
Jia HuJia Hu

Please upgrade your Eclipse IDE to Spring'12

 

See:

http://wiki.developerforce.com/page/Force.com_IDE_Release_Notes

IvanB@LMIvanB@LM

Thanks very much. After upgrading my Eclipce I see the newer field. 

This was selected as the best answer