[ad_1]
Final Up to date on June 25, 2022 by Rakesh Gupta
Large Thought or Enduring Query:
How do you routinely add new customers to a Public Group or Queue?
Aims:
This weblog submit will assist us to know the next
- Create automation related to creating a brand new consumer
- Routinely add a consumer to a specified Public Group or Queue with Circulation
- What’s MIXED DML error, and how one can keep away from it
Warren Mason is working as a System administrator at Common Containers (UC). His group needs to develop an automation to routinely add new customers to the Public Group Common Container Customers.
Automation Champion Method (I-do):
Within the article Automatically Add User to a Chatter Group, we mentioned a strategy to routinely add new customers to the Chatter group utilizing clicks, not code. We additionally mentioned a strategy to keep away from MIXED DML errors.
Now let’s take it a step additional and talk about a strategy to auto-add new customers to a Queue or Public Group. There are few options attainable for the above enterprise state of affairs. We’ll use Document-Triggered Circulation to unravel the above enterprise requirement.
Earlier than continuing forward, you need to perceive group and GroupMember objects.
- Group: – This object represents the Queue and Public Group. They’ll include particular person customers, different teams, and the customers in a selected function. By utilizing the Kind discipline, you may distinguish between Queue and Public Group. For Public Group (Use Kind = Common) and for Queue (Use Kind = Queue).
- GroupMember: – Represents a Consumer or Group that could be a member of a public group.
Earlier than discussing the answer, let me present you a diagram of a Course of Circulation at a excessive stage. Please spend a couple of minutes going by way of the next Circulation diagram and understanding it. Let’s start constructing this automation course of.
Guided Apply (We-do):
There are two steps to unravel Warren’s enterprise requirement utilizing Document-Triggered Circulation. We should:
- Create a public group
- Salesforce Circulation Steps:
- Outline move properties for record-triggered move
- Components to find out whether or not the file is created or up to date
- Add a call ingredient to verify if the consumer is Lively or Not
- Add a get file ingredient to seek out public group Id
- Add a call ingredient to verify the general public group discovered or not (from step 4)
- Add a create data ingredient so as to add a consumer to the general public group
Step 1: Create a Public Group
- Click on Setup.
- Within the Fast Discover field, sort Public Group.
- Click on on the Public Group button.
- Clicks on the New button.
- Label the Group then press the tab key, the Group Title will auto-populate.
- Click on Save.
Step 2.1: Outline Circulation Properties
- Click on Setup.
- Within the Fast Discover field, sort Flows.
- Choose Flows then click on on the New Circulation.
- Choose the Document-Triggered Circulation possibility, and click on on Create and configure the move as follows:
- Object: Consumer
- Set off the Circulation When: A file is created or up to date
- Set Entry Standards
- Situation Necessities: None
- Optimize the Circulation For Motion and Associated Data
- Click on Accomplished.
Step 2.2: Components to Decide Whether or not the Consumer is Created or Up to date
- Beneath Toolbox, choose Supervisor, then click on New Useful resource to find out whether or not the file is new or outdated.
- Enter the next info:
- Useful resource Kind: Components
- API Title: forB_IsNew
- Knowledge Kind: Boolean
- Components: IsNew()
- Click on Accomplished.
Step 2.3: Utilizing Resolution Component to Verify if Consumer IsActive or Not
Now we are going to use the Resolution ingredient to verify if the consumer account is energetic or not.
- On Circulation Designer, click on on the +icon and choose the Resolution ingredient.
- Enter a reputation within the Label discipline; the API Title will auto-populate.
- Beneath Final result Particulars, enter the Label the API Title will auto-populate.
- Situation Necessities to Execute Final result: All Circumstances Are Met (AND)
- Row 1:
- Useful resource: {!$Document.IsActive}
- Operator: Is Null
- Worth: {!$GlobalConstant.True}
- Add Situation
- Row 2
- Useful resource: {!forB_IsNew}
- Operator: Equals
- Worth: {!$GlobalConstant.True}
- Row 1:
- When to Execute Final result: If the situation necessities are met.
- Click on Accomplished.
Step 2.4: Including a Get Document Component to Discover Public Group Id For Common Container Customers
The subsequent step is to seek out the Public Group for Common Container Customers.
- On Circulation Designer, beneath the Sure node, click on on the +icon and choose the Get Data ingredient.
- Enter a reputation within the Label discipline; the API Title will auto-populate.
- Choose the Document Group object from the dropdown record.
- Choose All Circumstances Are Met (AND).
- Set Filter Circumstances
- Row 1:
- Area: Title
- Operator: Equals
- Worth: Common Container Customers
- Row 1:
- How Many Data to Retailer:
- choose Solely the primary file
- The best way to Retailer Document Knowledge:
- Select the choice to Routinely retailer all fields.
- Click on Accomplished.
Step 2.5: Utilizing Resolution Component to Verify the Public Group from the Document Variable (from step 4)
Now we are going to use the Resolution ingredient to verify the Document Variable from step 4 to seek out if it returns the general public group or not.
- On Circulation Designer, click on on the +icon and choose the Resolution ingredient.
- Enter a reputation within the Label discipline; the API Title will auto-populate.
- Beneath Final result Particulars, enter the Label the API Title will auto-populate.
- Situation Necessities to Execute Final result: All Circumstances Are Met (AND)
- Row 1:
- Useful resource: {!Find_Public_Group}
- Operator: Is Null
- Worth: {!$GlobalConstant.False}
- Click on Accomplished.
- Row 1:
Step 2.6: Add Create Data Component to Add New Consumer to the Public Group
The ultimate step is so as to add new customers to the general public group, as quickly because the new consumer account will get activated. We’ll use the Create Data ingredient.
- On Circulation Designer, beneath the Group Discovered node, click on on the +icon and choose the Create Data ingredient.
- Enter a reputation within the Label discipline; the API Title will auto-populate.
- Enter the next info:
- How Many Data to Create: One
- The best way to Set the Document Fields: Use separate sources, and literal values
- Object: GorupMember
- Set Area Values for the Group Member
- Row 1:
- Row 1:
- Area: GroupId
- Worth: {!Find_Public_Group.Id}
- Add Area
- Row 2
- Area: UserOrGroupId
- Worth: {!$Document.Id}
- Row 1:
- Click on Accomplished.
In the long run, Warren’s Circulation will appear to be the next screenshot:
As soon as every part seems good, carry out the steps beneath:
- Click on Save.
- Enter Circulation Label the API Title will auto-populate.
- Click on Present Superior.
- API Model for Operating the Circulation: 50
- Interview Label: Routinely Add New Consumer to Public Group {!$Circulation.CurrentDateTime}
- Click on Save.
Virtually there! As soon as every part seems good, click on the Activate button.
Proof of Idea
Now onwards, when a consumer account is created, Document-triggered Circulation will routinely set off and add the consumer to a public group (Common Container Customers). Let’s try it out.
- Now create a brand new consumer by way of the UI
- As soon as the consumer is created, they’re routinely added to the general public group Common Container Customers inside a couple of seconds, as proven within the following screenshot:
Formative Evaluation:
I wish to hear from you!
What’s one factor you discovered from this submit? How do you envision making use of this new data in the actual world? Be happy to share within the feedback beneath.
[ad_2]
Source link