Add/Remove follower to record with Visual Workflow



In Salesforce a user can follow Chatter groups or Records. The chatter group manager can also add/remove peoples to the group, for this Salesforce provides out-of-the box functionality. To manage recordfollower/Subscriber Salesforce does not have any inbuilt functionality like owner want to add follower or want to remove the follower from object records.
Business Use case :- Higher management in Universal Container wants to develop an application for system administrator, so that they can use it to Add/Remove follower/subscriber to the account records.
Solution of above business requirement
First of all I want to say thanks to Andrew Johnson to share his idea and flow( Add follower to record)  he shared in success community. In this blog we will use Visual workflow to solve the above business requirement. My main aim is to show the various ways to use Visual workflow in your organization. Before going ahead with the solution you have to understand  EntitySubscription Object. It’s Represents a subscription for a user following a record or another user.User can subscribe to a record or to another user.
Field Name
Details
ParentId
ID of the record or user which the user is following
SubscriberId
ID of the User who is following the record or user
 Add Follower to record
First we will ask the end user to enter User Full Name whom they want to make a follower of the record. On the next screen we will show a list of user matches with user name entered on Screen 1 and ask them to select one, As soon as they clicked on the finish button user will be added as follower of the record. To develop add functionality follow the below instructions
  • Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
  • Click on New Flow, it will open flow canvas for you
  • First create a variable with name AccountIDwe will use in the Flow
  • Drag and drop a Screen ( Give the name Enter Follower) on window, and click on Add a Field ( Give the name Enter Follower Name ) to enter User Full Name from user as shown in below screenshot

  • The next task is to display all users where the User Full Name match with Screen1 enter follow name field. To do that again drag and drop Screen on canvas ( Give the name Choose Follower), add Radio button ( Give the name Choose Follower Name) as shown in below screenshot

Now select Dynamic choice as shown in the above screenshot ( Give the name ChooseFollowerFromUser), under object select User , Add filters criteria Name Contains Enter_Follower_Name (Screen1 Input field),Under Choice label select Name as shown in below screenshot

  • On the next screen, our main work is find out selected user’s ID. To do that we will use Record Lookupelement ( Give the name Find Selected user ID), under Loo up select User , enter search criteria Nameequal to Choosee_Follower_Name, and store recordID into some variable as shown in below screenshot

  • The next task is to create a record into EntitySubscription object . it’s required Parentid andSubscriberId. we have SubscriberIdfor ParentID we will use AccountID variable.  Now Drag and DropRecord Create element into the canvas ( Give the name Auto add follower into the record), under create select object EntitySubscription and assign value into Parentid and SubscriberId as shown in below screenshot 

Finally it will look like below screenshot

Now create a button (Add Follower) on Account object to call this flow and assign {!Account.Id} into variableAccountID
Link will be /flow/Add_Follower_into_record?AccountID={!Account.Id}&retURL=https://ap1.salesforce.com/{!Account.Id}
Remove Follower from the record
First we will ask the end user to enter a UserID of the user’s whom they want removed as a follower (Subscriber)  from the record, as soon as they click on finish button user will automatically removed from follower (Subscriber) list to the record. To develop remove functionality follow the below instructions
  • Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
  • Click on New Flow, it will open flow canvas for you
  • First create a variable with name AccountID and we will use into the flow
  • Drag and drop a Screen ( Give the name Remove Subscriber) on window, and click on Add a Field ( Give the name Enter Subscriber User ID ) to enter a UserID from user as shown in below screenshot

  • In the next screen we will remove this subscriber from the record. Drag & Drop Record Delete element into the canvas, and give the name Remove follower. Under delete drop-down selectEntitySubscription object and map the field as shown in below screenshot
Now create a button (Remove Follower) on the Account object to call this flow and assign {!Account.Id} into variableAccountID
Link will be /flow/Remove_follower?AccountID={!Account.Id}&retURL=https://ap1.salesforce.com/{!Account.Id}
Now it’s time to test this feature
Add Follower
1) To add follower to the record, navigate to the Accounts tab and click on any Account Name to open it’s detail page, and click on the Add Follower button as shown in below screenshot
2) Enter name of the user whom you want to add subscriber of that account record, you can take help from below screenshot  and click on Next

3) On the next screen you can select subscriber from the list of users based upon your search criteria, as shown in below screenshot and click on Next

4) You will drill down to account detail page and user will added as follower, below is the screenshot as a proof

Remove Follower
We will remove the same follower that we added on the last step.
1) To remove the follower from the record, navigate to the Accounts tab and click on any Account Name to open it’s detail page, and click on the Remove Follower button.
2) It will open Remove follower flow for you, enter UserID  whom you want to remove as a subscriber of the  record, you can take help from below screenshot and click on Next

3) You will redirect to account detail page, and the user is removed from follower list. You can check below screen shot

Note:- You can enhance Add/remove functionality by using Loop and collection  (Spring’14 pilot feature) to show the list of users that are not following record. Currently I am showing all users from an organization based on user name entered (Step 2 – Enter new subscriber name) .

Post a Comment

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget