FeedComment
Supported Calls
create(), delete(), describeSObjects(), getDeleted(), getUpdated(), query(), retrieve(), search(), update(), upsert()
Special Access Rules
Note the following when working with feed comments.
- You must have read access to the feed’s parent type to see a FeedComment record.
- You must be able to access the feed to add a comment.
- If the comment is related to a user record, the user can delete the comment. For example, if John Smith makes a comment on Sasha Jones’ profile feed, Sasha can delete the comment.
- If the context user has the Insert System Field Values for Chatter Feeds user permission, the create field property is available on CreatedBy and CreatedDate system fields. During migration, the context user can set these fields to the original post’s author and creation date. The fields can’t be updated after migration.
- Modify All Data
- Modify All Records on the object associated with the feed and delete permission on the parent feed
- Moderate Chatter
- Manage Unlisted Groups
Only users with this permission can delete items in unlisted groups.
Fields
Field | Details |
---|---|
CommentBody |
|
CommentType |
|
FeedItemId |
|
HasEntityLinks |
|
InsertedById |
|
IsRichText |
|
IsVerified |
|
LastEditById |
|
LastEditDate |
|
ParentId |
|
RelatedRecordId |
|
Revision |
|
Status |
|
SystemModstamp |
|
ThreadChildrenCount |
|
ThreadLastUpdatedDate |
|
ThreadLevel |
|
ThreadParentId |
|
Usage
-
As of API version 23.0 and later, if you have View All Data permission, you can query FeedComment records directly without an ID filter. If you don’t have View All Data permission, you can’t query FeedComment records directly, with or without an ID filter.
For example, the following query returns general information about a feed:SELECT ID, CreatedDate, CreatedById, CreatedBy.FirstName, CreatedBy.LastName, ParentId, Parent.Name, Body FROM FeedItem WHERE CreatedDate > LAST_MONTH ORDER BY CreatedDate DESC, Id DESC
-
You can search for text in comments using SOSL. For example, the following Java class uses search() to find the string “foo” in any field of a record:
public void searchSample() { try { SearchResult sr = connection.search("find {foo} in all fields " + "returning feedcomment(Id, FeedItemId, CommentBody)"); // Put the results into an array of SearchRecords SearchRecord[] records = sr.getSearchRecords(); // Check the length of the returned array of records to see // if the search found anything if (records != null && records.length > 0) { System.out.println("Found " + records.length + " comments: "); // Display each comment for (SearchRecord record : records) { FeedComment comment = (FeedComment) record.getRecord(); System.out.println(comment.getId() + ": " + comment.getCommentBody()); } } else { System.out.println("No records were found for the search."); } } catch (ConnectionException ce) { ce.printStackTrace(); } }
- If you use an Apex trigger to modify the Body of a FeedComment object, all mentions hyperlinks are converted to plain text. The mentioned users don't get email notifications.