6

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

4

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.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.