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
JNicJNic 

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.

 

 

Thanks,

JNH

spraetzspraetz

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.

JNicJNic

Nope... not working...

 

 

    public void makeFeePost() {
        feedPost fp = new feedpost();
        fp.type = 'LinkPost';
        fp.parentId = p.id;
        fp.body = '@[005A0000000JauJ]';
        fp.linkUrl = 'http://www.google.ca';
        fp.title = dateTime.now().format();
        insert fp;
    }

 

 

tried:

@005A0000000JauJ

@[005A0000000JauJ]

{!005A0000000JauJ}

{@005A0000000JauJ}

{!@005A0000000JauJ}

 

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

 

that's @lame

SuperfellSuperfell

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