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
Chris760Chris760 

Where does Chatter store the @[User] information?

Lets say I wrote the following on the Account chatter feed: "@[Bob Jones] thanks for all the help you gave to @[Debbie Johnson] yesterday!  I'll make sure that @[John Smith] follows up with you guys tomorrow."

Where (or how) does chatter actually store the @[User] information for all the users mentioned in that post?  When I go to the FeedComment or FeedItem objects in the developers workbench (depending on whether the post is the first in a thread or not), the "Body" field in both objects always shows the above post as "@Bob Jones thanks for all the help you gave to @Debbie Johnson yesterday!  I'll make sure that @John Smith follows up with you guys tomorrow."

It appears that, when it gets saved to the database, it takes off the brackets.  But if I were to save either version of that post directly to salesforce using APEX (with or without the brackets), it somehow breaks the feature that allows the various users profiles (Bobs, Debbies, and Johns) to pop up when you mouse over their user hashtag.

So what I'm trying to figure out (with not much luck) is, how does the system store or create the relationship between the user hashtags in a message, and the users whom those hashtags reference?  My end goal is to be able to insert chatter posts via apex where I can add the @[User] hashtags and those users will actually have those posts show up in their chatter feeds.
Best Answer chosen by Chris760
Swati GSwati G
Hi,

You can use connectAPI. Many Chatter REST API resource actions are exposed as static methods on Apex classes in the ConnectApi namespace. These methods use other ConnectApi classes to input and return information. The ConnectApi namespace is referred to as Chatter in Apex.

Connect API: https://www.salesforce.com/us/developer/docs/apexcode/Content/connectAPI_overview.htm

Here is Jeff's blog where he has shared the code: http://blog.jeffdouglas.com/2013/10/03/chatter-for-apex-code-examples/ 

All Answers

Swati GSwati G
Hi,

You can use connectAPI. Many Chatter REST API resource actions are exposed as static methods on Apex classes in the ConnectApi namespace. These methods use other ConnectApi classes to input and return information. The ConnectApi namespace is referred to as Chatter in Apex.

Connect API: https://www.salesforce.com/us/developer/docs/apexcode/Content/connectAPI_overview.htm

Here is Jeff's blog where he has shared the code: http://blog.jeffdouglas.com/2013/10/03/chatter-for-apex-code-examples/ 
This was selected as the best answer
Chris760Chris760
Thanks Swati!  So it seems like there's no way to bulkify the insert of a chatter feed that has an @mention then, am I correct?  

The other thing that I guess I find confusing is that I can't find the location of where the @mention information is stored anywhere in the salesforce database.  Are there like a bunch of other meta data sub-objects somewhere that store that info and aren't accessible via API?
Swati GSwati G
Hi Chris,

Yes, I also didnt find any way to bulkify the insert of a chatter feed that has an @mention. I am also not aware where is salesforce storing @mention data. I will let you know if i find something related to this.