salesforce之chatter
2016-02-26 09:28
453 查看
http://deferloader.blog.uhuru.co.jp/?p=2763
//投稿処理
private void doChatter(list<string> chatterMsgList){
// ChatterGroup名指定
// ChatterGroup取得
//CollaborationGroup objCollaborationGroup = [select Id ,Name from CollaborationGroup where Name =: groupName limit 1];
//string targetGroupId = objCollaborationGroup.Id;
string targetGroupId = this.getGroupId();
string message ='';
for (String chatterMsg: chatterMsgList) {
message += chatterMsg;
}
// フィードのINSERT
FeedItem feed = new FeedItem();
feed.parentId = targetGroupId;
feed.body = message;
insert feed;
}
public static void toChatter(String chatterMsg) {
String communityId = null;
ConnectApi.FeedType feedType = ConnectApi.FeedType.UserProfile;
String userToMention = UserInfo.getUserId();
String subjectId = userToMention;
ConnectApi.MessageBodyInput messageInput = new ConnectApi.MessageBodyInput();
messageInput.messageSegments = new List<ConnectApi.MessageSegmentInput>();
// メンション
ConnectApi.MentionSegmentInput mentionSegment = new ConnectApi.MentionSegmentInput();
mentionSegment.id = userToMention;
messageInput.messageSegments.add(mentionSegment);
// 本文
ConnectApi.TextSegmentInput textSegment = new ConnectApi.TextSegmentInput();
textSegment.text = '\r\n';
messageInput.messageSegments.add(textSegment);
textSegment = new ConnectApi.TextSegmentInput();
textSegment.text = chatterMsg;
messageInput.messageSegments.add(textSegment);
ConnectApi.FeedItemInput input = new ConnectApi.FeedItemInput();
input.body = messageInput;
// Chatter通知
ConnectApi.FeedItem feedItemRep =
ConnectApi.ChatterFeeds.postFeedItem(communityId, feedType, subjectId, input, null);
}
//投稿処理
private void doChatter(list<string> chatterMsgList){
// ChatterGroup名指定
// ChatterGroup取得
//CollaborationGroup objCollaborationGroup = [select Id ,Name from CollaborationGroup where Name =: groupName limit 1];
//string targetGroupId = objCollaborationGroup.Id;
string targetGroupId = this.getGroupId();
string message ='';
for (String chatterMsg: chatterMsgList) {
message += chatterMsg;
}
// フィードのINSERT
FeedItem feed = new FeedItem();
feed.parentId = targetGroupId;
feed.body = message;
insert feed;
}
public static void toChatter(String chatterMsg) {
String communityId = null;
ConnectApi.FeedType feedType = ConnectApi.FeedType.UserProfile;
String userToMention = UserInfo.getUserId();
String subjectId = userToMention;
ConnectApi.MessageBodyInput messageInput = new ConnectApi.MessageBodyInput();
messageInput.messageSegments = new List<ConnectApi.MessageSegmentInput>();
// メンション
ConnectApi.MentionSegmentInput mentionSegment = new ConnectApi.MentionSegmentInput();
mentionSegment.id = userToMention;
messageInput.messageSegments.add(mentionSegment);
// 本文
ConnectApi.TextSegmentInput textSegment = new ConnectApi.TextSegmentInput();
textSegment.text = '\r\n';
messageInput.messageSegments.add(textSegment);
textSegment = new ConnectApi.TextSegmentInput();
textSegment.text = chatterMsg;
messageInput.messageSegments.add(textSegment);
ConnectApi.FeedItemInput input = new ConnectApi.FeedItemInput();
input.body = messageInput;
// Chatter通知
ConnectApi.FeedItem feedItemRep =
ConnectApi.ChatterFeeds.postFeedItem(communityId, feedType, subjectId, input, null);
}
相关文章推荐
- js如何获取object类型里的键值
- 屏幕密度
- LeetCode Pascal's Triangle
- 字符串全排列问题
- 【Maven进阶三】 Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4……
- bzoj 2281 [Sdoi2011]黑白棋(博弈+组合计数)
- 关于学习Gson的简单分析
- 用Scrapy爬取教务处通知公告
- React-Native的学习指南
- Xcode更新7.2 之后注释插件失效的解决办法
- 关于C++中的友元函数的总结
- java 实现打印(图片和文本)
- Android常用延时操作的两种方法
- 自定义ListView item包含checkbox实现单选记录自己开发是遇到的问题
- PCH 警告:标头停止点不能位于宏或#if块中
- web app开发 转
- C语言多个源文件编译
- C语言一维数组转换为二维数组
- pojo实体创建
- 【转】MySQL数据丢失讨论