You need to sign in to do that
Don't have an account?
veeru_pari
tag search
Hi,
Can i please get the code how tow develop search functionality based on tags in salesforce.(tag search functionality).the user should be able to search the question and answer based on tags.like stackoverflow.
Thanks
Veeru
Can i please get the code how tow develop search functionality based on tags in salesforce.(tag search functionality).the user should be able to search the question and answer based on tags.like stackoverflow.
Thanks
Veeru
Or do you mean the legacy tags feature on objects like Case?
SOQL
Normally for a text-based search like this, you would use SOSL. But SOSL doesn't look for related records, and currently :
Select Id from Topic where Name = 'topic-name'
Take those IDs bundle them up into a list or set and turn around and query TopicAssignment.
SELECT EntityId, TopicId FROM TopicAssignment where TopicId in : myListOfTopicIds
You can then use the EntityId values to work with the specific records that are assigned to that topic.
ConnectApi
There is an alternative which is to use the ConnectApi classes. In this instance, you would use this:
ConnectApi.Feed topicFeed = ConnectApi.Feed.getFeed(null, ConnectApi.FeedType.Topics , <the topic Id> , null);
You'd then have to cycle through the feed and get feed items, and use those to detect what kind of feed items they are.
My wish is that some day in the future you can just throw a topic at SOSL, and then have SOSL return a bunch of records/feeds/etc that are being used by that topic...but as of today, that is just a dream.
Topics is a very new part of the application right now, so there is no settled opinion on best practice for what you want to do yet.
You are a trailblazer, my friend. :-)