この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

メンションを含むコメントの投稿

メンションを含むコメントを投稿する方法は 2 つあります。GitHub の ConnectApiHelper リポジトリを使用して 1 行のコードを記述するか、postCommentToFeedElement(communityId, feedElementId, comment, feedElementFileUpload) をコールする次の例を使用します。

1String communityId = null;
2String feedElementId = '0D5D0000000KtW3';
3
4ConnectApi.CommentInput commentInput = new ConnectApi.CommentInput();
5ConnectApi.MentionSegmentInput mentionSegmentInput = new ConnectApi.MentionSegmentInput();
6ConnectApi.MessageBodyInput messageBodyInput = new ConnectApi.MessageBodyInput();
7ConnectApi.TextSegmentInput textSegmentInput = new ConnectApi.TextSegmentInput();
8
9messageBodyInput.messageSegments = new List<ConnectApi.MessageSegmentInput>();
10
11textSegmentInput.text = 'Does anyone in this group have an idea? ';
12messageBodyInput.messageSegments.add(textSegmentInput);
13
14mentionSegmentInput.id = '0F9D00000000oOT';
15messageBodyInput.messageSegments.add(mentionSegmentInput);
16
17commentInput.body = messageBodyInput;
18
19ConnectApi.Comment commentRep = ConnectApi.ChatterFeeds.postCommentToFeedElement(communityId, feedElementId, commentInput, null);