Auto Creates a Private Chatter Group

Auto Creates a Private Chatter Group

Last Updated on March 6, 2022 by Rakesh Gupta

Big Idea or Enduring Question:

How do you auto-create a chatter group using Salesforce Flow?

Objectives:

This blog post will help us to understand the following
  • Understanding Quick actions
  • How to use the quick action in Salesforce Flow
  • Add a Time-dependent action in After-save Record-Triggered Flow

Business Use case

Warren Mason is working as a System administrator at Gurukul on Cloud (GoC). His organization wants to auto-create a private Chatter group, whenever an active campaign gets created. For the Chatter group name, they want to use the campaign name.  

Automation Champion Approach (I-do):

Actions allow users to perform certain activities very quickly – such as create records, update records, send an Email, log calls, call a Lightning component, execute Lightning Flow, and call a Visualforce page.
 
With custom actions, users save precious time by getting quick access to important information. It also has the capability to pre-populate the data from the record.   There are two types of actions available to users: object-specific and global. 
 
  • Object-Specific Actions:- These actions have automatic relationships to other records. The actions let users quickly create or update records, send an Email, log calls, call Lightning components, execute Lightning Flow, and call a Visualforce page in the context of a particular object.
  • Global Actions – A System Administrator can create global actions in Setup. Then, s/he can put global actions anywhere on an object that supports actions. Using global actions, users can log calls, create records, send an email, call a Visualforce page, execute a Lightning component, and call Custom Canvas, all without leaving the page.
To solve this requirement, we will use the After-save Record-Triggered Flow. Check out this article to understand why we are using after-save record-triggered flow for this scenario.

Before discussing the solution, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes going through the following Flow diagram and understand it.
Let’s begin building this automation process.

Guided Practice (We-do):

There are 3 steps to solve Warren’s business requirement using Record-Triggered Flow. We must: 
  1. Define flow properties for record-triggered flow
  2. Add a decision element to check if the campaign is active
  3. Add Action – New Group

Step 1: Define Flow Properties

  1. Click Setup.
  2. In the Quick Find box, type Flows.
  3. Select Flows then click on the New Flow.
  4. Select the Record-Triggered Flow option, and click on Create and configure the flow as follows:
    1. Object: Campaign
    2. Trigger the Flow When: A record is created or updated
    3. Set Entry Criteria
      1. Condition Requirements: None
    4. Optimize the Flow For Action and Related Records
  5. Click Done.

Step 2: Using Decision Element to Check if Campaign is Active

Now we will use the Decision element to check if the campaign is active. 

  1. On Flow Designer, click on the +icon and select the Decision element.
  2. Enter a name in the Label field; the API Name will auto-populate.
  3. Under Outcome Details, enter the Label the API Name will auto-populate.
  4. Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
    1. Row 1:
      1. Resource: {!$Record.IsActive}
      2. Operator: Equals
      3. Value: {!$GlobalConstant.True}
  5. When to Execute OutcomeOnly if the record that triggered the flow to run is updated to meet the condition requirements.
  6. Click Done.
 
The reason why we would select the Yes checkbox for the question — Only if the record that triggered the flow to run is updated to meet the condition requirements — is to allow the Salesforce flow to execute the actions only if the record meets the criteria now, but the values that the record had immediately before it was saved didn’t meet criteria. This means that these actions won’t be executed when irrelevant changes are made.

Step 3: Add Action – New Group

Next, we will use another Core Action – New Group – to create a private Chatter Group. Now follow the steps below:

  1. On Flow Designer, below the Yes node, click on the +icon and select the Action element.
  2. Below Filter By, select Type.
  3. Search and select the New Group from the dropdown menu
  4. Label the new action Create a Chatter Group
  5. Set Input Values
    1. Row 1:
      1. Field: Access Type
      2. Value: Private
    2. Row 2:
      1. Field: Name
      2. Value: {!$Record.Name}
    3. Row 3:
      1. Field: Related Record ID
      2. Value: {!$Record.Id}
  6. Click Done.
 
In the end, Warren’s Flow will look like the following screenshot:


Once everything looks good, perform the steps below:
  1. Click Save.
  2. Enter Flow Label the API Name will auto-populate.
  3. Click Show Advanced.
  4. Type: Record-Triggered Flow
  5. API Version for Running the Flow: 54
  6. Interview Label: Record-triggered: Campaign After Save Flow {!$Flow.CurrentDateTime}
  7. Click Save

Almost there! Once everything looks good, click the Activate button. 

Proof of Concept

Now onwards, if a business user creates a campaign and makes it active, then Salesforce Flow will automatically trigger and create a Chatter group.

  1. Now create a new campaign (Demo Campaign 1), as shown in the following screenshot:
  2. Navigate back to the Groups tab and check the newly created chatter group.

Formative Assessment:

I want to hear from you!

What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? Feel free to share in the comments below.

Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

12 thoughts on “Auto Creates a Private Chatter Group

  1. Thank you for the quick response. I believe I am not following. Is NetworkID is Community.ID? Also, I am trying to create a process where if a filed in account is updated to “True”, then it should automatically create a community chatter group and have account owner as the group owner. Is it possible to do? IF yes, the above like can be taken as reference?

    Chirag

          1. Hi Rakesh,
            Thank you for your help yesterday. I would like ask another help. Since you help me auto create Community Chatter group once an account is created, Do you have any documents to auto populate the URL of the community group in a custom filed under Account Object? This will give owner of the account direct access and make them aware of the existence the group related to the accounts they own.
            Chirag

          2. Thank you Rakesh, How do I Reference URLs for every Community Chatter group created by the flow/processbuilder? I would really appreciate if you could direct me to a step by step process. I am new at this 🙂

            1. If I am not wrong you have used to create a Chatter Group. Record Create element allows you to save newly created record ID into a variable that you can refer later.

  2. Hi Rakesh,
    I want to create Community Chatter Group exactly the way you documented for the internal Chatter group. Do you have any document for that?
    Thank you
    Chirag

  3. Hi Rakesh,
    Regarding the above process builder on – auto create a private chatter group. I am trying to do a similar thing by adding a button (Create chatter group) on Opportunity page, which users have the option to push if they want to create a chatter group on that deal with all deal team members. I have two questions related to this requirement:

    1. I would like to create an object specific quick action rather than global action. But if i go with quick action, it just gives me an option between event, task and log a call. I don’t want those.
    2. In the process builder above the type of chatter group didn’t give me an option of “unlisted”. We don’t want users to create private group instead we want them to create “unlisted groups”. Can you explain why.

    Thank you for your help.

    Regards,
    Pooja

Leave a Reply

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