Is it possible to query Chatter tags via APEX? For e.g. if I'd like to know the tags associated with an Account record, can I query them using SOQL?
Anup
Attribution to: Anup
Possible Suggestion/Solution #1
I don't think you can. The API for working with Chatter via APEX is currently very limited, you can't even query based on the contents of the body.
Also AFAIK you can't currently create posts from Apex that have Mentions or Tags in them.
There is meant to be a pilot of a new Chatter API but we've had no luck joining it.
Attribution to: Joel Mansford
Possible Suggestion/Solution #2
For querying, one option would be to use SOSL. It isn't a perfect solution by any means, but the following did return records accurately for me on a limited number of items in a test org, where my hashtag was #test:
[FIND '#test' RETURNING FeedItem, FeedComment]
Using tags while constructing posts is not possible right now in Apex. But I have heard of people using the Chatter REST API as a loopback call to construct the message text and build the @mention and #hashtag message segments. I'm sorry I don't have examples, I just know of someone who talked about it, I don't have details and haven't built that solution myself.
Attribution to: pchittum
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/1111