We have a custom field on the
Opportunity object which creates a parent/child lookup relationship. A parent opportunity may have multiple child opportunities. A family of opportunities is simply a group of opportunity objects related directly or transitively through that field. A child has a parent, and through that parent has siblings.
The next step is if a user follows one opportunity, the system will automatically create
EntitySubscriptions so the user will follow the entire family of opportunities.
It is not possible to create a trigger on the
EntitySubscription SObject: this would be the easiest solution, as an
after insert trigger would make it trivial to look up the family of opportunities, find missing
EntitySubscriptions, and create them. I did not see any Chatter code recipes that might help. Finally, the GUI functionality to follow an object is not even a button, it is a hyperlink outside the editable page layout.
How can I implement this functionality given the constraints of the Salesforce platform?