How to mention a user in a Chatter Group in an Apex Trigger?
There are similar questions existing in SFSE but they all seem to have outdated answers using old cumbersome APIs. I believe the easiest way is to use the
FeedItem object. I have only managed to send a message to a user (not the same as an "@" mention) and share with the company using the below code. Documentation is scanty regarding how to mention a user in a Chatter Group.
FeedItem post = new FeedItem(); post.ParentId = u.Id; post.Body = 'Please find the download URL herewith.'; post.Title = 'User Guide'; post.LinkUrl = 'https://c.cs7.content.force.com/sfc/servlet.shepherd/version/download/068M0000000CvrF'; feedItemList.add(post);