Chatter (in my opinion) is one of the really neat features of salesforce, allowing users to follow records that might be important to them is just one of the “Killer Apps” of this functionality. Ironically enough, being that this is a social network, is the request for that one can just add followers automagically if “X” condition is met. There are even a couple apps on the appexchange for that.
To me, this takes a bit of the social out of “social networking”, so I am going to sketch out a solution that is a bit more personable but still makes it easy to add a follower
In a nutshell, it goes a little something like this:
1) Within a record, the current user feels that another user (or themselves) should be on the follow list
2) The current user clicks a button. In this case, I have called it “Pied Piper”
3) A flow is launched that does the following:
1. Looks up a user based information given
2.Attaches that user to the current record as a follower
As usual, I am just sketching going to provide the foundation for this functionality. The magic here is that you can flows to do some neat stuff like attaching multiple users, adding comments, tags, etc. You don’t have to add this stuff in, but I would encourage playing around with it to see what you can / can’t do. Also, a quick Caveat. I found that a user will have to have “Modify All” permissions on the object you are pushing this out to.
That aside, now we get to the Nuts & Bolts of the matter. I have got a couple of components that I am going to be using:
- A visual flow
- A custom button driven by a URL
- A nice cup of Coffee (Optional, or not)
This flow function sounds exciting and awesome (Follower Updates, Magic!), but is really basic. There are four components to this flow, Entry screen, Record lookup, Record Create and the confirmation screen (optional). There is however a critical variable, varAccountID. This is the variable that houses the ID that is passed over via URL. Just be aware when you are building this out!
On the entry screen, there is a text box for entry of a person’s name. The text box value is passed to the Record Lookup. One of the easiest improvements would be making this multi search (name, ID, email), just something to keep in mind.
The flow does a look up on name, and returns the userID.
Next up is the Record Create on the object Entity Subscription. In this case, the parentID is the accountID, but it can be anything. SubscriberID is just the UserId pulled above.
Once the record is created, there is a confirmation screen. This is an optional step, but something I like to do.
Now that I have a flow in place, I create a button (Pied Piper) on the account layout.
This button is nothing fancy, just running a hyperlink that will open up the flow AND push over the accountID of the record the user is currently in. I did add the retURL on the end so that instead of a loop, the user is returned to the accounts page.
Just to reiterate, this is the foundational work. You could implement this into production and have something that works but it isn’t going to be awesome. Here are the required proof shots!
As always, questions or comments, hit me up!