Is there an object for following a record in chatter?

  • 3
  • Question
  • Updated 2 years ago
  • Answered
  • (Edited)
We have a part of our partner portal where clients log in to submit new work requests. This generates a record in a custom object UCCLien__c. We'd like for this submittal action to also cause the person submitting to follow this record in Salesforce, so when we change a field that is in the feed tracking, e.g. Status, they get notified, e.g. Jack Sanford changed the Status to Complete. 

Is there a Chatter object that links a user to an object's record? Then we could create a new row in this object's model with the submit button actions. 

If not, any other ideas for achieving this? 
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb

Posted 3 years ago

  • 3
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,004 Points 20k badge 2x thumb
EntitySubscription is the object.

Make sure to read the docs as there are a number of implementation considerations involved when using EntitySubscription.

What I recommend is to have 2 Row Actions on a table, one which creates a new EntitySubscription record, one which deletes an existing one, both Conditionally Rendered based on whether the running user has already subscribed to follow the given record. The Conditional Rendering on this will be tricky, I recommend pulling in the FeedSubscriptionsForEntity Child Relationship for the record, limit 1 with a Condition to limit to just Subscriptions for the running User, and then create a Ui-Only Formula Field on the Model which returns true if there is a Child Relationship record for the given record, e.g. 

{{FeedSubscriptionsForEntity.totalSize}}==1

Here is a link to the XML for a sample page which lets you follow/unfollow Accounts --- the approach is identical for any standard or custom object:

https://bitbucket.org/skuid/samplepages/raw/b3fad03ff8ac294ef513213de7efcb1cdc733383/pages/FollowAnd...





(Edited)
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
I like the use of the UI-only field to pull in the child relationship field. Before that I used to have to hack the XML to put the child relationship field name in there render condition. 
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
That UI only field trick is pretty slick! 
Photo of Chelsea Curtis

Chelsea Curtis

  • 1,300 Points 1k badge 2x thumb
This is great! Is there a way to show a table with only Open Opportunities that the current user follows? I want to be able to put a condition or filter on the UI-only field mentioned, but it appears UI-only fields do not work on conditions/filters.

Is there a workaround for this?

Thanks,
Chelsea