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

FeedPost insert with "@mention"

Does anyone know how to insert a FeedPost object with an "@mention" in it?


I've tried doing it manually, then querying for feedPost.body - and it just has plain text of "@UserName"


I assume I have to do something with an id or something in the string? Can't quite figure this out or find documentation.






Try doing {@userId} if you want the user to receive an email about it or {!userId} if you do not.


I haven't tested this myself, but I believe it should work.


Nope... not working...



    public void makeFeePost() {
        feedPost fp = new feedpost();
        fp.type = 'LinkPost';
        fp.parentId =;
        fp.body = '@[005A0000000JauJ]';
        fp.linkUrl = '';
        fp.title =;
        insert fp;










This all just dumps out plain text... My guess is that we can't hit it with apex yet...


that's @lame


You can't currently do this via Apex (or the Web Services API)