Last Updated on May 5, 2022 by Rakesh Gupta
Big Idea or Enduring Question:
- How can you automatically create a public group for a new account?
If you have a large Community implemented and a very active instance of Salesforce, you are probably leveraging Public Groups extensively. The public group represents a group of users. We can add any number of users to a public group. There is no limitation on the number of members per Public Group. It is the daily job of the Salesforce administrator to add or remove users to the Public group.
Objectives:
This blog post will help us to understand the following
- Use filters and conditions to design a process.
- Understand how to use Flow to create a record
- Create a record-triggered flow to auto-create a public group
- and much more
Business Use Case
Arda Turan is working as a System Administrator at Gurukul on Cloud (GoC). They have just implemented a partner community to manage their partner’s related work better in one place and help them to sell more. As a part of the partner onboarding process, once both parties sign the contract. The next steps are to create partner account and contacts in Salesforce, to grant them partner community access. Currently, at Universal Containers they have few manual processes that they want to automate are mentioned below
- As a part of the partner onboarding process, the system administrator at Universal Containers manually creates a public group (Account Number for Name and DeveloperName) for each partner account. (Blog 142)
- Then add partner users from that account to Public Group, created in the preceding step. (Blog 102)
Automation Champion Approach (I-do):
I’m going to share a solution for the first requirement in this article and will publish another article for the second requirement i.e. Blog 102. There are a few possible solutions for the first business scenario, but I’ll use Record-triggered Flow to solve it. Let’s take a minute’s pause here and understand Group objects in Salesforce.
Object Name | Details |
Group | It represents a set of user records. The group can contain individual users, other groups, the users in a particular role or territory, or the users in a particular role or territory plus all of the users below that role or territory in the hierarchy. |
Assumption: – I’m going to use Account Number as public group Label and Group Name. The reason behind it, we need a unique name for the public group name and the account number (Standard field on account object) is always unique for business. If you want to use something else like Account Name Plus Account Number or ID, then consider using the formula field.
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 Arda’s business requirement using After-Save Record-Triggered Flow. We must:
- Define flow properties for record-triggered flow
- Add a decision element to check if it is a partner account
- Add a create records element to create a new public group
Step 1: Define Flow Properties
- Click Setup.
- In the Quick Find box, type Flows.
- Select Flows then click on the New Flow.
- Select the Record-Triggered Flow option, click on Create and configure the flow as follows:
- Object: Account
- Trigger Opportunity Flow When: A record is created or updated
- Set Entry Criteria
- Condition Requirements: None
- Optimize the Flow For Action and Related Records
- Click Done.
Step 2: Using Decision Element to Check if the Account is a Partner Account or Not
Now we will use the Decision element to check if the account is a partner account or not.
- On Flow Designer, click on the +icon and select the Decision element.
- Enter a name in the Label field; the API Name will auto-populate.
- Under Outcome Details, enter the Label the API Name will auto-populate.
- Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
- Row 1:
- Resource: {!$Record.IsPartner}
- Operator: Equals
- Value: {!$GlobalConstant.True}
- Row 1:
- When to Execute Outcome: Only if the record that triggered the flow to run is updated to meet the condition requirements
- 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 record-triggered 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 the criteria. This means that these actions won’t be executed when irrelevant changes are made.
Step 3: Add Action – Create a Record
The next step is to create a public group, as soon as an account gets enabled as a Partner account. For this, we will use the Create Records element.
- On Flow Designer, below the Yes node, click on the +icon and select the Create Records element.
- Enter a name in the Label field; the API Name will auto-populate.
- Input the following information:
- Enter Label the API Name will auto-populate.
- How Many Records to Create: One
- How to Set the Record Fields: Use separate resources, and literal values
- Object: Group
- Set Field Values for the Event Relation
- Row 1:
- Field: Name
- Value: {!$Record.AccountNumber}
- Click Done.
In the end, Arda’s Flow will look like the following screenshot:
Once everything looks good, perform the steps below:
- Click Save.
- Enter Flow Label the API Name will auto-populate.
- Click Show Advanced.
- API Version for Running the Flow: 55
- Interview Label: Auto Create a Public Group For New Account {!$Flow.CurrentDateTime}
- Click Save.
Almost there! Once everything looks good, click the Activate button.
Proof of Concept
If a sales rep or system administrator creates or updates an account as a partner account, record-triggered flow will fire and automatically create a Public Group.
- Navigate to the Account tab and identify an account that you want to enable as a Partner account. In this case, I want to enable Grand Hotels & Resorts Ltd as a Partner account.
- Click on Manage External Account and then, click Enable as Partner, as shown in the following screenshot:
- Wait for few minutes and then navigate to the public group (Click on Setup | Administer | Manage Users | Public Groups)
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.
Gupta, i´m not able to reply to my post, but i´ll need to build something totally new….see, at start, i wanted to create the group after the user creates a service territory (it´s a Field Service project, so the group is created automatically right after the service territory), but the grup was not being created….so i´m thinking about create the group after the service territory is created.
hi!
i´m trying to do something similar to this scenario, but the process builder should start after a non-admin user hits the entry criteria.
Is it possible for a non-admin to create a public group through flow/pb?
Yes it is possible. Could you please send me few screenshot of your automation?
i´ll need to build something totally new….see, at start, i wanted to create the group after the user creates a service territory (it´s a Field Service project, so the group is created automatically right after the service territory), but the grup was not being created….so i´m thinking about create the group after the service territory is created.
hello, when i was setting criteria for action.
like this
[Account].IsPartner Equals Boolean True
i m unable to set boolean, and i didn’t see any partner field, its show only partneraccount id, plz guid me
thanks in advance
Select ‘Partner Account’ – API name (IsPatner)
Hello sir,
After creating a flow its giving an run time warning Create_New_Public_Group is not connected to anything. How to resolve this or what should i have to put there.
Ignore that warning message