Hands on 1 - copying the record followers

A user can follow records and users in Salesforce. As an owner or manager of a Chatter group or as a system administrator, you can add or remove members from Chatter groups. But you can't add or remove followers from or to the records.

Let's look at a business scenario. Alice Atwood is working as a system administrator at Universal Container. On a daily basis, she receives plenty of requests for Opportunity owners to add the same followers from old Opportunity X to new Opportunity Y. Currently, she is handling this through data loader, but before that, she used to spend time on data massaging.

We will create a Flow that will allow the system administrator to copy followers from Opportunity record X (old) to Opportunity record Y (new). We can assume that as the Opportunity owner wants to copy followers to a new record, it means that currently, records don't have any followers.

The steps to develop this Flow are as follows:

  1. Navigate to Setup | Build | Create | Workflow & Approvals | Flows.
  2. Click on the New Flow button, and it will open the Flow canvas for you.
  3. Create a Text variable VarT_NewOppID to pass the new Opportunity ID (where the user wants to add followers) from the custom URL.
  4. Then, navigate to the Palette tab, and drag and drop the Screen element onto the canvas; it will open a Screen element window for you. Enter Name as Enter Old Opportunity ID; you can also add Description. Under the Navigation Options section, select Don't show Previous button from the dropdown. Optionally, you can add Help Text as well.
  1. The next task is to add a field onto the screen in order to capture the old Opportunity ID (from where the Opportunity owner wants to copy the followers). Add a Textbox field on Screen by clicking on the Add a Field tab. Double-click on the Textbox field available under the INPUTS section, as shown in the following screenshot:
  1. Once you are done, click on the OK button.
  2. Now our next task is to get the list of followers from the old Opportunity. For this, we have to use the Fast Lookup element. The reason behind using Fast Lookup is that it allows you to save the outcomes into SObject Collection variable. Create an SObject Collection variable SocvOld_Opportuntiy_Followers for the object type EntitySubscription and set Input/Output Type as Input and Output, as shown in the following screenshot:
  1. Once you are done, click on OK. We will use it in Fast Lookup to store the record details. Similarly, create another SObject Collection variable SocvNew_Opportuntiy_Followers and one SObject variable SovIndividual_Follower_Details for the object EntitySubscription.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.179.139