• Richa Gupta 40
  • 0 Points
  • Member since 2018

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1
Hi All,

I have a requirement to send emails to the account owner whenever a post is created in their feed.

I wrote the below code to insert feeditem. If i add createdbyid field in post, i am unable to get the emails.

If i comment the createdbyid, then i am able to recieve the emails. 
FeedItem post = new FeedItem();
post.ParentId = '0F9c0000000DLT6CAO'; 
post.createdById = '005a000000BA2zjAAD';
post.Body = 'Happy Anniversary, Sean!';
insert post;
Can anyone please let me know how can i achieve this?

Thank You