function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CypherCypher 

Move UserPost to Object

I am writing an apex trigger on User to check when a user updates their status with a particular hashtag.  Using the string in the hashtag, I want to look up a record on a custom object and then MOVE the UserUpdate to the Object's Chatter Feed.   First question: has anyone done this and second, does anyone have a quick code snippet to assist me?

 

Thanks for all your help.

Jia HuJia Hu

FeedItem fi = new FeedItem();

fi.CreatedById = 'UserId';

fi.Body = 'CurrentStatus';

fi.ParentId = ' object record id ';

insert fi;