FeedItem represents an entry in the feed, such as changes in a NewsFeed, UserProfileFeed, or record feed, including status updates, text
posts, link posts, and content posts.This object is available in API version
21.0 and later. This object replaces FeedPost.
You can delete a feed item only if you created
it, or if you have the any of these permissions:
“Modify All Data”
“Moderate Chatter”
Only users with the “Modify All
Data” permission can delete a FeedItem of TypeTrackedChange.
If the logged-in user has
the Insert System Field
Values for Chatter Feeds user permission, the create field property is available on CreatedById and CreatedDate system
fields for this object. This allows the logged-in user to set these
fields to the original post author and creation date upon migration
instead of accepting the system field value when migrated, which would
be the logged-in user and the date the migration was performed, respectively.
The fields can't be updated after migration.
Fields
Field Name
Details
Body
Type
textarea
Properties
Create, Filter, Nillable, Sort
Description
The content of the FeedItem. Required when Type is TextPost. Optional when Type is ContentPost or LinkPost. This is the message that appears in the feed.
CommentCount
Type
int
Properties
Filter, Group, Sort
Description
The number of FeedComments associated
with this feed item.
ConnectionId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
When a PartnerNetworkConnection makes a change to a record that is tracked, the CreatedBy field contains the ID of the system administrator while the ConnectionId contains the ID of the PartnerNetworkConnection that made the change. Available if Salesforce to Salesforce is enabled for your organization.
ContentData
Type
base64
Properties
Create, Nillable
Description
The file uploaded to the feed.
Required if Type is ContentPost.Encoded file data. Cannot be 0 bytes. Can be any format. Setting
this field automatically sets Type to ContentPost.
ContentDescription
Type
textarea
Properties
Create, Nillable, Sort
Description
The description of the file specified
in ContentData.
ContentFileName
Type
string
Properties
Create, Group, Nillable, Sort
Description
The file uploaded to the feed.
Required if Type is ContentPost.The name of the file uploaded
to the feed. Setting ContentFileName automatically
sets Type to ContentPost.
ContentSize
Type
int
Properties
Group, Nillable, Sort
Description
Read only. Automatically determined during
insert. The size of the file (in bytes) uploaded to the feed.
ContentType
Type
string
Properties
Group, Nillable, Sort
Description
Read only. Automatically determined during
insert. The MIME type of the file uploaded to the feed.
FeedPostId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
This field was removed in API version
22.0, and is available in earlier versions for backward compatibility
only.
ID of the associated FeedPost. A FeedPost represents the following types of changes in an FeedItem: status updates, changes to tracked fields, text posts, link posts,
and content posts.
InsertedById
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
ID of the user who added this object
to the feed. For example, if a client application migrates multiple
posts and comments from another application into a feed, then InsertedById is set to the ID of the logged-in user.
IsDeleted
Type
boolean
Properties
Defaulted on create, Filter, Group, Sort
Description
Indicates whether the record has been
moved to the Recycle Bin (true)
or not (false).This is a standard system field.
LikeCount
Type
int
Properties
Filter, Group, Sort
Description
The number of FeedLikes associated with
this feed item.
LinkUrl
Type
url
Properties
Create, Filter, Nillable, Sort
Description
The URL of a LinkPost.
ParentId
Type
reference
Properties
Create, Filter, Group, Sort
Description
ID of the object type to which the FeedItem is related.
For example, set this field to a UserId to post
to someone’s profile feed, or an AccountId to post to a specific account.
RelatedRecordId
Type
reference
Properties
Create, Group, Nillable, Sort
Description
ID of the ContentVersion object associated with a ContentPost. This field is null for all posts except ContentPost.
For
example, set this field to an existing ContentVersion and post it to a feed as a FeedItem object
of TypeContentPost.
Title
Type
string
Properties
Create, Filter, Group, Nillable, Sort
Description
The title of the FeedItem. When the Type is LinkPost, the LinkUrl is the URL and this field is the link name.
Type
Type
picklist
Properties
Create, Filter, Group
Description
The type of FeedItem:
UserStatus—automatically
generated when a user updates their status
TrackedChange—a change or group of changes to a tracked field
TextPost—a direct
text entry on a feed
LinkPost—a URL posting
on a feed
ContentPost—an uploaded
file on a feed
DashboardComponentSnapshot—a posting of a dashboard snapshot on a feed.
ApprovalPost—automatically
generated by a feed query on an approval item.
The following values appear in
the Type picklist for all feed objects but apply only to CaseFeed:
CaseCommentPost—generated
event when a user adds a case comment for a case object.
EmailMessageEvent—generated
event when an email related to a case object is sent or received.
CallLogPost—generated
event when a user logs a call for a case through the user interface.
This event is also generated by CTI calls.
ChangeStatusPost—generated
event when a user changes the status of a case.
AttachArticleEvent—generated
event when a user attaches an article to a case.
ActivityEvent—generated
event when a user adds or updates an Event or a Task.
Usage
Use this object to reference an update to any feed, such as a NewsFeed, UserProfileFeed, or record feed.
As of API version 23.0 and beyond, if you have “View All Data”
permission you can directly query for a FeedItem. The following example returns all feed items, ordered
by date descending:
SELECT CommentBody, FeedItemId
FROM FeedComment
WHERE CreatedDate > LAST_MONTH
ORDER BY CreatedDate DESC, Id DESC;
Prior to API version 23.0 , FeedItems were always associated with a feed item
(such as AccountFeed or OpportunityFeed) so you needed to query for them through the feeds. The following
example returns all feed items for a given account, ordered by date
descending:
SELECT Id, Type, FeedItem.Body
FROM AccountFeed
WHERE ParentId = AccountId ORDER BY CreatedDate DESC
A FeedItem of UserStatus is automatically created if a user updates their CurrentStatus. You can’t explicitly create a FeedItem of TypeUserStatus.
If the logged-in user has
the Insert System Field
Values for Chatter Feeds user permission, the create field property is available on CreatedById and CreatedDate system
fields for this object. This allows the logged-in user to set these
fields to the original post author and creation date upon migration
instead of accepting the system field value when migrated, which would
be the logged-in user and the date the migration was performed, respectively.
The fields can't be updated after migration.
The size limit for an attachment on a profile or news feed is
25 MB.
The size limit for an attachment on a record feed is 5 MB.
You can’t use the content fields to update or delete the
content.
You can’t filter or update the content fields.
Deleting a FeedItem via the API also deletes the associated content. Likewise, undeleting a FeedItem restores associated content.
After uploading to a feed, it is possible for an attachment or
document to be deleted, marked private, or hidden by sharing rules.
In this case, all content fields in FeedItem appear as null in a SOQL query.
You can’t explicitly create or delete a FeedTrackedChange record.