How can I show only posts from a chatter feed filtered to a specific topic

  • 1
  • Question
  • Updated 4 years ago
  • Answered
I would like to display a table of chatter posts that are just the feeditems with a particular topic. I've tried making a model condition where the body contains the #topic but that didn't seem to filter the items entirely. I'm not sure if having a seperate topic model and using that for a subquery or as a field from another model, but I kinda tried that. Our business goal is to have employees add a client's favorite foods/etc to a chatter post with #faves and then to show that list handily on the clients record. 
Photo of Chris Reilly

Chris Reilly

  • 70 Points

Posted 4 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Chris,

I'm not super familiar with the chatter object. Have you tried a filter on the table component?
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I assume that you are using the "Topics for objects" functionality that Salesforce rolled out last year.   In this case the Topic is assigned to the object record (Specific Accound, Opportunity etc),  and all feed items in that record are associated with that topic. 

There is a FeedItem object that has all the chatter feed items in your database.  You can add a condition to a model built on this object that gets specific Topics.  It will be a subquery condition,  which is a two step process. 

1. Create new condition with the following properties: 
- Field:  ParentId
- Value Type: Result of subquery
- Value Join Object: TopicAssignment
- Value Join Field:  EntityId




2. Now you can add a subquery under the main condition in the list (block with green plus sign icon). 
- Field: Topic Id

Here you can assigne a specific Topic,  use a URL parameter to send a Topic from another page (maybe a topic list page),  or leave the value blank and create a filter on your FeedItem table. 

That should work.  I've created a simple page that does this filtering.  The xml for it is below: 

<skuidpage showsidebar="true" showheader="true" tabtooverride="Topic" unsavedchangeswarning="">
<models>

<model id="Topics" limit="20" query="true" createrowifnonefound="false" sobject="Topic" orderby="Name" type="" doclone="">
<fields>
<field id="Name"/>
<field id="CreatedDate"/>
<field id="CreatedById"/>
<field id="CreatedBy.Name"/>
<field id="Description"/>
<field id="TalkingAbout"/>
<field id="Id"/>
</fields>
<conditions>

</conditions>
<actions/>
</model>

<model id="FeedItem" limit="20" query="true" createrowifnonefound="false" sobject="FeedItem">
<fields>
<field id="Body"/>
<field id="Type"/>
<field id="ParentId"/>
<field id="Parent.Name"/>
<field id="TopicAssignments" type="childRelationship" limit="10">
<fields>
<field id="TopicId"/>
<field id="Topic.Name"/>
</fields>
</field>
<field id="CreatedDate"/>
<field id="Parent.Type"/>
<field id="CreatedById"/>
<field id="CreatedBy.Name"/>
</fields>
<conditions>
<condition type="fieldvalue" field="Parent.Type" operator="=" inactive="true" enclosevalueinquotes="true" name="__autofilter__Parent.Type" state="filterableoff" value=""/>
<condition type="join" value="" field="ParentId" operator="in" mergefield="Id" novaluebehavior="deactivate" enclosevalueinquotes="true" joinobject="TopicAssignment" joinfield="EntityId" state="filterableoff" inactive="true" name="TopicsAll">
<conditions>
<condition type="fieldvalue" value="" enclosevalueinquotes="true" field="TopicId" state="filterableoff" inactive="true" name="SpecificTopic"/>
</conditions>
</condition>
<condition type="fieldvalue" field="Type" operator="=" inactive="true" enclosevalueinquotes="true" name="__autofilter__Type" state="filterableoff" value=""/>
</conditions>
<actions/>
</model>
</models>
<components>
<skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="false" model="FeedItem" buttonposition="" mode="readonly">
<fields>
<field id="CreatedDate" valuehalign="" type="" allowordering="true"/>
<field id="CreatedById" valuehalign="" type=""/>
<field id="Body"/>
<field id="Type"/>
<field id="ParentId"/>
<field id="Parent.Type"/>
</fields>
<rowactions/>
<massactions usefirstitemasdefault="true"/>
<views>
<view type="standard"/>
</views>
<filters>
<filter type="select" filteroffoptionlabel="All Topics" createfilteroffoption="true" affectcookies="true" autocompthreshold="25" conditionsource="manual" labelmode="no" condition="SpecificTopic">
<sources>
<source type="model" effectsbehavior="defaultandothers" model="Topics">
<labeltemplate>{{Name}}</labeltemplate>
<valuetemplate>{{Id}}</valuetemplate>
<effects>
<effect action="activate" value="{{Id}}" condition="TopicsAll"/>
</effects>
</source>
</sources>
</filter>
<filter type="select" filteroffoptionlabel="All Entity Types" createfilteroffoption="true" affectcookies="true" autocompthreshold="25" conditionsource="auto" labelmode="auto" conditionfield="Parent.Type"/>
<filter type="select" filteroffoptionlabel="Feed Item Types" createfilteroffoption="true" affectcookies="true" autocompthreshold="25" conditionsource="auto" labelmode="auto" conditionfield="Type"/>
</filters>
</skootable>

</components>
<resources>
<labels/>
<css/>
<javascript>

</javascript>
</resources>
</skuidpage>