I have a requirement to produce a unified search across Salesforce records using tags and documents in Content. Both records and Content items may have received the same tag from a user and my unified search should bring both back when the user enters a Tag name (for example "sample_tag").

Question is using Apex&SOQL&SOSL how can I find records and / or Content items that have been tagged with "sample_tag". I can't find any standard object that might hold the relationship.


  • 1
    You can access normal objects (e.g. Account, Contact) through their respective tag objects (e.g. AccountTag, ContactTag). It appears that Content tags are only available through SOSL. A complete solution, then, would involve iterating through each taggable object, and running a SOQL for normal objects, and a SOSL for Content items. If there's an easier way to access this data, I don't know of it. I'm not making this an answer in case someone actually has one :p – sfdcfox Sep 16 '13 at 17:03

Your Answer

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

Browse other questions tagged or ask your own question.