Getting Started with Process Builder – Part 90 (Skyrocket Your Productivity by Leveraging the Power of Chatter Automation!)

Getting Started with Process Builder – Part 90 (Skyrocket Your Productivity by Leveraging the Power of Chatter Automation!)

Last Updated on December 5, 2020 by Rakesh Gupta

Chatter Group is one of the best ways to boost collaboration in your organization. A Chatter group represents a group of users – one can add unlimited members to a Chatter Group but, a user can join a maximum of 300 groups; and, your company can have a total of 30,000 groups. Chatter groups can be public, private, unlisted, or archived.

Check out my previous article: 

In the aforementioned article, I have discussed few advanced concepts that will help you to automate Chatter Group membership. If you didn’t get a chance to read it yet, do it now! It will significantly improve your knowledge of Process Builder and automation around Chatter. 

Below are few tasks, related to Chatter groups, that can be automated to enhance productivity.

  • Whenever a group is created, auto update the Group Type to Private
  • Criteria based auto-archiving – Archive this group if there are no posts or comments for 90 days.
  • Send email notification to group owner or managers when Chatter group doesn’t have a description
  • And, last but not least, auto add all System Administrators to a new Chatter Group

Until now, it was necessary to write Apex code to manage the aforementioned tasks. Since Spring’18 release, however, it is now possible to manage these tasks with the help of Flow and Process Builder. Let us see how to get started on working smarter by tackling a business use case.

Business Use Case

Edward Backhouse is working as a System Administrator at Gurukul on Cloud (GoC)At GoC they use Chatter extensively to collaborate internally. Edward received the following requirement from upper management:

  • Whenever a Chatter Group is created, automatically add system administrators to the group.

Yes, yes, I know! Adding System Administrators to a new Chatter Group is just one of the Chatter automations listed above! But, what fun is it in being spoon feed? Why not harness your newly acquired knowledge – of Process Builder and Flow – and try your hands on the other aforementioned scenarios?

Challenge accepted?

What do you have to lose by accepting the challenge? Why worry when you know that I am just a click away? If, despite trying, you find yourself getting stuck then, just drop me a line! Go ahead, master the material by flying solo on the other scenarios!

A solution for the above business requirement

Ok, now let us get back to creating a solution for the problem at hand – whenever a Chatter Group is created, automatically add system administrators to the group.

There are a few possible solutions for the above business scenario, but we’ll use  Flow and Process Builder to solve the above business requirementBefore trying to understand the technical aspect of the solution, let us spend some time to understand the general flow at a high level. Please spend few minutes to go through the following flow diagram and understand it.

 

 

Before we proceed further, let us understand the characteristics of CollaborationGroupMember – It represents a member of a Chatter group.

  1. Navigate to Setup (Gear Icon) | Setup | PLATFORM TOOLS | Process Automation | Flows. Click on the New Flow button; it will open the Flow canvas for you. Create variables in the Flow, as shown in the following table:
    Name Variable type Input/Output type
    VarTGroupID Text Input and Output
    VarTCurrentUserID Text Input and Output
    SocUsers User Input and Output
    SovUser User Input and Output
    SocGroupMembers CollaborationGroupMember Input and Output
    SovGroupMember CollaborationGroupMember Input and Output

    We will pass the value to VarTGroupID and VarTCurrentUserID variables through the Process Builder.

  2. Now we will use the Record Lookup element to find users with the System Administrator profile, as shown in the following screenshot:
  3. To find all active system administrators, drag and drop a Fast Lookup onto the window and map the fields as shown below:
    1. Select Object User
    2. Enter criteria as follows:
      1. ProfileId {!VarTProfileID}
      2. Id <>{!VarTCurrentUserID}, add this filter to remove the current user from the list because he is already added to the Chatter group as soon as he created the group. 
      3. IsActive = {!$GlobalConstant.True}
    3. Store the users Id into an SObject Collection Variable {!SocUsers}, as shown in the following screenshot: 
  4. Now we will use the Loop element to extract records from the SObject Collection Variable (SocUsers) and store it in the SObject Variable (SovUser). Click on the Palette tab and drag and drop the Loop element onto the Flow canvas. Map the Loop element according to the following screenshot:
  5. The next step is to add system administrators to newly created Chatter Group, as per business use case. For this, we will use Assignment element. Drag and drop an Assignment Element (Give the name Add admins to Chatter Group) onto the canvas and map the fields according to the following screenshot:
  6. Next, add all SObject Variables into a SObject Collection Variable. So that, in the end, we can add the members together. Drag and drop an Assignment element (Give the name Add into a list) onto the canvas and map the fields according to the following screenshot:
  7. The final task is to insert data into the CollaborationGroupMember object. For this, we will use the Fast Create element. Drag and drop a Fast Create element onto the canvas and map the field according to the following screenshot: 
  8. Use connectors to connect the elements used in the Flow. Finally, your Flow will look like the following screenshot:
  9. Once done, Save the flow and name it Add admins to Chatter Group – Flow, with Type: Autolaunched Flow. Do not forget to activate the Flow by clicking on the Activate button.
  10. The next step is to create a process that will fire when a new Chatter group is created and then it will execute Flow, which we have just created. To do this, Navigate to Setup (Gear Icon) | Setup | Process Automation | Process Builder
  11. To create a new process from scratch, click on the New Button available on Process Management page. A popup will appear where you have to enter the Name (Use Add admins to Chatter Group as the name)API Name and Description as shown in the screenshot below:
  12. Once you are done, click on the Save button.
  13. Click on the Object node to add object and then select the Group object. For the entry criteria, select only when a record is created, as shown in the screenshot below:
  14. Once you are done, click on the Save button.
  15. The next task is to add Process Criteria, so that process will always fire whenever a Chatter group is created. To do this click on Add Criteria, enter Name and Type of actionfollow the instructions below:
  16. Once you are done, click on the Save button.
  17. Now we have to add an Immediate action into the Process to add system administrators to newly created Chatter group. Click on Add Action (Under Immediate actions), Select the type of action (In our case Flows), and then fill the values into fields to define the action – as shown in the following screenshot:
  18. Once you are done, click on the Save button. 
  19. In the end, your Process will look like the following screenshot:
  20. Do not forget to activate the Process by clicking on the Activate button.

It’s time to test this feature

Next time, when a Chatter Group is created by the user, the process we created ( Using Process Builder) will fire and add all active system administrators to the Chatter Group.

Wasn’t that a great journey? Now you know how to auto add users from a specific profile to Chatter group. 

Yes, go ahead! Show off your newly acquired skills to your friends, colleagues, and families!

Please feel free to add constructive comments, insights – and yes, challenges too! – to the blog. Good Luck in your Journey towards becoming a Salesforce Ninja!

Technical Editor and Proofreader: - Munira Majmundar
Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

2 thoughts on “Getting Started with Process Builder – Part 90 (Skyrocket Your Productivity by Leveraging the Power of Chatter Automation!)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.