0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ApexからChatterに投稿する

Last updated at Posted at 2021-01-05

ちょうど、質問があって回答がされていたので忘れないように記録しておきます。

How to Create chatter post and mention user in chatter post using Apex class?

//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; // Record Id eg. Opportunity id, custom object id..
post.Body = 'Enter post text here';
post.LinkUrl = 'http://www.infallibletechie.com';
insert post;

//Adding a Content post
FeedItem post = new FeedItem();
post.ParentId = oId; // Record Id eg. Opportunity id, custom object id..
post.Body = 'Enter post text here';
post.ContentData = base64EncodedFileData;
post.ContentFileName = 'infallible.pdf';
insert post;
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?