Find your content:

Search form

You are here

Why does my Apex Chatter trigger title show up as "User name to User Name"?

 
Share

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.';
insert.post;`

Attribution to: user988

Possible Suggestion/Solution #1

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

post.createdById = '00760000005T5HG';


Attribution to: logontokartik
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/5028

My Block Status

My Block Content