上述网址中创建最新活动FeedItem是在recipe6
//Adding a Text post 插入文本
FeedItem post = new FeedItem();
post.ParentId = oId; //eg. Opportunity id, custom object id..
post.Body = 'Enter post text here';
insert post;
//Adding a Link post 插入链接
FeedItem post = new FeedItem();
post.ParentId = oId; //eg. Opportunity id, custom object id..
post.Body = 'Enter post text here';
post.LinkUrl = 'http://www.someurl.com';
insert post;
//Adding a Content post 插入文件(上传附件)
FeedItem post = new FeedItem();
post.ParentId = oId; //eg. Opportunity id, custom object id..
post.Body = 'Enter post text here';
post.ContentData = base64EncodedFileData(注意类型-流);
post.ContentFileName = 'sample.pdf';
insert post;
当然上面只是举了最经常见的三个例子,其实FeeItem类型还有很多
介绍了FeedItem相关属性
- TrackedChange—a change or group of changes to a tracked field
- UserStatus—automatically generated when a user adds a post
- TextPost—a direct text entry on a feed
- LinkPost—a URL posting on a feed
- ContentPost—an uploaded file on a feed
- PollPost—a poll posted on a feed
- DashboardComponentSnapshot—a posting of a dashboard snapshot on a feed.
- ApprovalPost—automatically generated by a feed query on an approval item
- CollaborationGroupCreated—automatically generated post on a user’s feed when the user creates a public group
-
ActivityEvent—generated event when a user or the API adds a Task associated with a feed-enabled parent record (excluding email tasks on cases) or when a user or the API adds or updates a Task or Event associated with a case record (excluding email and call logging).
For a recurring Task with CaseFeed disabled, one event is generated for the series only. For a recurring Task with CaseFeed enabled, events are generated for the series and each occurrence.
- 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
查找FeedItem 主键Id
List<FeedItem> flist = [SELECT ID,Title,Body, LinkUrl from FeedItem];
我搜索自己的feedItem内容,共搜索到六条
flist = (
FeedItem:{Body=null, Id=0D59000000IjFsxCAF},
FeedItem:{Body=4廷44, Id=0D59000000IjwxXCAR},
FeedItem:{Body=null, Id=0D59000000Ik0C6CAJ},
FeedItem:{Body=466666, Id=0D59000000JAQlyCAH},
FeedItem:{Body=Enter post text here, Id=0D59000000JCxK1CAL},
FeedItem:{Body=Enter post text here, Id=0D59000000JCxhtCAD, LinkUrl=http://www.someurl.com, Title=www.someurl.com}
)
为FeedItem添加评论
FeedComment fcomment = new FeedComment();
fcomment.FeedItemId = fId; //Id of the FeedItem on which you want to comment
fcomment.CommentBody = 'Enter your comment here';
insert fcomment;