I created an apex trigger that posts a new feeditem to a user's feed every time the opportunity status gets changed to "Closed Won". It works fine except for the fact that the post title says "John Doe to Jane Doe". I only want "Jane Doe" to show up as im posting to her feed. Why is my name (John Doe) showing up in the post title? I'm the one who triggered it by closing the deal, but I only want the person's feed I'm posting to, to show up. Thoughts?

`FeedItem post = new FeedItem(); 
post.ParentId = '00760000005T5HG';
post.Body = 'Test.';

1 Answer 1


Try setting the FeedItem CreatedById to the User you are trying to post the feed to. In your example

post.createdById = '00760000005T5HG';

  • I believe "audit fields" (Created By, Creation Date) are locked down in Chatter like in other areas of the application and you have to contact support to make them writeable?
    – eyescream
    Commented Dec 4, 2012 at 10:47
  • You are right, but I was able to use CreatedById when creating the feedItem. Commented Dec 4, 2012 at 10:58
  • Its looks like we can either use InsertedById or CreatedById on FeedItem and set it to UserId, would resolve your original issue. I would go with InsertedById. Commented Dec 4, 2012 at 11:00
  • @logontokartik post.createdById worked. It was exactly what I was looking for thanks! On a side note, I tried InsertedById, and it said that field is not writable. Thanks again everyone!
    – user988
    Commented Dec 4, 2012 at 15:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .