Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a chatter post using an APEX trigger, and I'm almost there. I've gotten to this point:

ConnectApi.ChatterFeeds.postFeedItem(null, ConnectApi.FeedType.News, 'me', feedItemInput, null);

Which successfully creates the post that I want it to create, including an @mention. However, it posts it to the context user's ('me') chatter feed, whereas I want it to post to the feed of the record that set off the trigger.

Is it possible to set the 'parentId' field like you used to be able to with FeedItem? If so, how should I go about doing this? If not, is there an alternative?


share|improve this question
up vote 12 down vote accepted

Figured it out! Replace 'me' with the ID of the record to post to, and change ConnectApi.FeedType.News to ConnectApi.FeedType.Record, and you're good to go!

share|improve this answer
Awesome, great find. I know there is a waiting time, but make sure you come back and mark your answer when you can (I believe it is in two days). Upvoted! – Jesse Altman Feb 14 '13 at 21:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.