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

Tagged records and dealing with them in Apex/VF

How does one deal with record tags in Apex and Visualforce?  For instance, if I want to create a visualforce page that includes a dataTable of records with a certain tag, how do I search for the relevant records in my controller?  Is it a set of fields (Personal Tags, Public Tags) similar to a picklist multi-select?


I'm not really sure how to approach this



You can query the tag tables, one for each object.  They follow the format of AccountTag, CaseTag...  Just use SOQL in the controller to get the info you need, look up "tag" in the web services api doc to get a complete description of the tag model.  The type distinguishes between public and private.