Skip to main content
Patriece Wright (N/A) a posé une question dans #Chatter

I have a custom object for which I have enabled the chatter feed. I want to be able to count the number of posts made to Chatter on that object. I created a DLRS with the parent object being my custom object and the child object being FeedItem. The relationship field is ParentId. For the field to aggregate I selected 'CommentCount' to test. This is not functioning as intended, please advise.  #Chatter #DLRS Package #Declarative Lookup Rollup Summaries #Automation

2 réponses
  1. 30 nov. 2023, 06:00

    Hi @Patriece Wright,

     

    Unfortunately The FeedItem object doesn’t support aggregate functions in queries. Other way of doing above would be querying for FeedItems into a collection and checking the size in apex. Make sure to add any appropriate filters to the query to narrow down the results

    List<FeedItem> fiLst = new List<FeedItem>();

    fiLst = [SELECT Id FROM FeedItem WHERE Type = 'TextPost'];

    system.debug("FeedItem Count:"+ fiLst.size());

0/9000