Salesforce Flowsome!
An Easy Flow Guide For Admins
Flow: How To Use “Assignment”
Assignment is the equal sign of flow (As you see in the icon). If you want to change the value of your variables, you will have to do it through Assignments.
Some important notes before we dive into the details of Assignments:
1. Assignment Cannot Update Data Directly
If you have read my introduction of flow , you should know that Assignment is a logic element, so it does not have direct impact of your records. If you want to interact with your records, make sure you use a data element (Get, Create, Update, Delete).
2. Sometimes Assignment Can Be Skipped
Assignment is usually used for more complex operations (ex. in a loop or as a switch). If you simply want to change record fields, an Update Records element should be sufficient.
There are three main fields – Variable, Operator, and Value.
Assignment Fields
Assignment operators, check out how assignment can be used in real cases .
Flow: How To Use In / Not In Operators
Use Case: Connect Files to Multiple Records in Flow
Flow: How To De-duplicate Collection In 3 Ways
Use Case: Use Flow To Auto Close The Spam Case
Official Salesforce Help Article On Assignment
- ← Flow: How To Use Record Id
- Flow: How To Use “Delete Records” →
I am building out a record triggered task flow that uses a formula to update a field on the task. In the formula, I am using some lead record fields and used a get record element. I am trying to then populate that same value from the formula task to the lead. I came across your blog after trying to understand what I was doing wrong, currently I am using an assignment element to try to map the value from the formula to the lead field. Although, it works when I debug it doesn’t actually save the value on the record. Based on “1. Assignment Cannot Update Data Directly” on your blog I learned this is not possible, the introduction of flow link is not working for me, is that information available?
I want to assign a text variable to wo.serviceTerritory.SeriveResource. Can you please suggest me how can I do it with the Assignment component in flow ?Thanks
Hi, so is the field you want to update already exist in the Flow? If so, you can simply find that field and use the Equal operator. If not, you can use Update Records element to find the field and use Equal operator
Just want to say thank you so much Melody for putting these valuable information here, really easy to understand! There’s so much of effort that you’ve put into this blog. I really appreciate that you put the time and effort together to share your knowledge.
Cloud SYlla
Your Agile & Digital Partner
What is Assignment in Salesforce Flow – Detailed Guide
Salesforce is a rapidly growing customer relationship management platform that reshapes how businesses engage with their clients. It provides numerous features that assist in transforming your business's income by handling customer service, sales, marketing, and more.
At the heart of this transformation lies Salesforce Flow. It is an automation tool that helps users to create smooth workflows and improve operational efficiency. Now you must be thinking: what is Assignment in Salesforce Flow?
Don’t worry. We’ve you covered! In this blog, we’ll discuss a necessary component of the Salesforce system – Assignments in Salesforce Flow. Nowadays, every company wants to make its processes easier within the Salesforce ecosystem. It’s where Salesforce Flow Assignments come in.
This blog will provide all the necessary information to help understand Assignments in Salesforce Flow. So, let’s start!
Introduction to Salesforce Flow
Salesforce Flow is an automation tool within the Salesforce platform designed to simplify and automate complicated business procedures. It allows users to design, create, and manage workflows that guide users via a series of screens and collect data to perform specific actions.
Besides, with Salesforce Flow, you can automate repetitious tasks and integrate with external systems without extensive coding. You can use flow for various purposes, such as updating records, creating records, sending emails, and more.
In short, Salesforce flow provides a flexible and dynamic way to automate business processes, making it more effortless for organizations to adjust and optimize their workflows within the Salesforce environment.
For more details, visit How to Export Flow Salesforce.
What is Assignment in Salesforce Flow?
Understanding the Assignment element in Salesforce Flow seems a bit tricky at first, but there is nothing to worry about. We’ve created this guide in an easy-to-grasp way to help you understand quickly.
In Salesforce Flow, an "Assignment" is a fundamental building block that helps you manage and manipulate data and allows you to assign values to variables. Variables store and organize data within a flow, and Assignments enable you to control and modify these values as the flow progresses. It's like giving instructions to the flow on how to handle data.
In other words, Assignments are valuable when you need to perform calculations, update variables based on user interactions, or make decisions that dynamically affect the flow of your processes.
To simplify, imagine you're guiding a conversation in your flow, and Assignments are like the instructions you give to the system about what values variables should take on. This versatility allows you to create responsive flows, whether dealing with numbers, picklists, checkboxes, or text fields.
Benefits of Using Assignments in Salesforce Flow
Using Assignments in Salesforce Flow offers several benefits, such as:
Data Manipulation
Assignments allow you to manipulate data by changing the values of variables during the flow. It is especially beneficial for performing calculations or updating information based on specific conditions.
Dynamic Decision-Making
You can use Assignments to control the flow of your process dynamically. Depending on user inputs or other conditions, Assignments help set variables to different values to enable you to tailor the flow based on specific scenarios.
User Interaction Handling
In Visual Flows, Assignments are valuable for responding to user selections. You can adjust variables based on the user's choices within the flow by providing a more personalized and interactive experience.
Record Updates
Assignments are often used to update records. By assigning new values to fields in records, you can ensure that your Salesforce database stays up-to-date as your flow progresses.
Calculation Support
When dealing with numeric variables, Assignments excel in performing calculations. Whether it's summing up amounts from a query or applying mathematical operations, Assignments make complex calculations manageable.
Flexibility Across Field Types
Assignments aren't limited to numeric fields – you can use them with various field types, including checkboxes, picklists, and text fields. This versatility allows you to handle a wide range of data scenarios.
Customization and Adaptability
Knowing how to use Assignments effectively enhances the overall customization and adaptability of your Salesforce Flow. It allows you to create vibrant, responsive, tailored automation that aligns precisely with your business operations.
Basic Information About Assignments
What assignments do.
The Assignment element executes mathematical operations and transfers data between variables.
What Assignments don’t do?
They don't assess criteria to generate True/False results.
Assignments operate from the right to the left side.
Adding 1 to “Variable1” will increase the value of “Variable1.”
Setting “Variable1” to Equal “Variable2” transfers the value of “Variable2” to “Variable1.”
Assignment Fields
Variable [Place the variable you want to modify (change in value), whether it's an existing resource or one you intend to create.]
Operator (Specify how the variable changes based on the value. Remember, the available operators depend on the type of variable you are using.)
Value (It can be an existent resource or manually typed-in values.)
Popular Operators
Add (Available Variable Type: Number, Text, Date, Currency, Picklist, Collection.)
Subtract (Available Variable Type: Date, Number, Currency.)
Equals (Available Variable Type: Text, Number, Picklist, Date, Date/Time, Currency, Collection.)
Add Item (Multiselect Picklist)
Popular Collection Operations
Add At Start [Text Collections]
Remove After First [Text Collections]
Remove Uncommon
Equals Count
Essential Tips
If you want to run one assignment after another, employ two consecutive assignment elements.
Construct formula resources for complicated statements.
Utilize functions by incorporating them into a formula resource instead of using them directly.
Overall, the “Assignment” element is a necessary part of Salesforce Flow that enables users to change the value of variables and fields within a flow. It is a logic element that does not directly affect the contents of the Salesforce database but is used to interact with records and resources within the flow.
Additionally, the Assignment element helps set or change record values before creating or updating them and for using variables to perform logical functions. Besides, it’s important to note that Assignments cannot update data directly, and sometimes you can skip it if you can use a simple element like Update Records instead.
So, by understanding how to use the Assignment element, you can create more efficient and effective flows to automate your processes in Salesforce.
Recent Posts
Salesforce For Real Estate – Why it is the Best CRM Platform For Real Estate Agents?
What is Salesforce for Nonprofits and How to Employ it? Complete Guide for Beginners
What is Orchestration Flow in Salesforce? Detailed Guide
Comentarios
- Partner With Venn
- Schedule A Consult
Salesforce Flow Basics Pt. 1: Data Elements, Decision, and Assignment
Written by Jonathan Davis
The goal of this four-part series is to provide foundational knowledge on how to use Flows in Salesforce . Flows are a powerful tool for automating processes in Salesforce and are something that every Salesforce Administrator or Consultant should be familiar with.
At a high level, a flow involves a few basic concepts:
- Elements - The pieces used to build the flow. Each type of element performs a different function.
- Resources - These are created and exist inside a specific flow (as opposed to records that exist in the database) to perform logic and store values when the flow runs.
- Trigger - The event that tells the flow to begin and usually provides the flow with some starting information, such as a Salesforce record.
- Logic - The flow uses logic that you configure in the flow to decide what to do within the flow.
- Result - The flow does one or more actions, such as creating or updating a record in Salesforce, displaying information to a user, sending an email to a customer, or some combination of those actions, and then ends.
Salesforce Flows are declarative, which means they do not require writing code to set them up. This makes them readily accessible to Administrators and Consultants who have not learned how to write code. Salesforce continuously adds features to Flow Builder , so it can do many things that were once impossible without code.
Flows are built with a series of elements connected to one another. When a flow is triggered to run, it works its way through the elements one at a time and performs different logic and actions based on which element is used and the way it is configured.
In this series, we will discuss all of the elements available to work with in the Flow Builder.
Jump to a section:
• Data Elements (Create, Update, Get, and Delete) • Assignment Element • Decision Element • Tips and Tricks
Data Elements (Create, Update, Get, and Delete)
In Flow Builder, there are three groups of elements: Interaction, Logic, and Data .
The Data Elements reach out from the flow instance and interact with Salesforce data, allowing the flow to retrieve information from or make changes to records in the database.
Create Records
The Create Records element allows you to create new records in your Salesforce org’s database. It can be used to create one or multiple records.
When creating one record, the simplest way is to select “Use separate resources, and literal values.” Choose the type of object you want to create a record for, and assign the field values you want the new record to have.
Once the record is created this way, you also can reference the newly created Record ID in other flow elements.
In this example, we created a new Account Record for Venn Technology:
You can also reference a record variable or collection of records used previously in the flow and create a new record using the values that were set previously. This is the only way to create multiple records with one Create Records element.
Update Records
The Update Records element is very similar to the Create Records element, except that it makes changes to existing records instead of creating new ones.
It is also similar to the Get Records element in that you are able to filter for the records you want to update when you use the “Use separate resources, and literal values” option. When filtering records this way, be aware that the Update element will revise all records in the database that meet the criteria, so it’s a good idea to be as specific as possible with your filters.
Alternatively, you can select “Use the IDs and all fields from a record or record collection” to update a record that was previously stored in the flow, such as one from a Get Records element. In this case, to make changes to the values on that record, you should have done so previously in the flow using the Assignment element.
In this example, we use the Update Records element to update the MailingState field of all contacts in the system that have an AccountID field value of “0014T000008zal9QAA.” If we only wanted to update a single contact, we would need to add more filters, such as the Contact ID, or FirstName and LastName fields.
Get Records
The Get Records element is used to “get” one or more records from the database based on filter criteria set in the component. Getting a record stores its values within the flow, as well as the values of records it looks up to (such as a Contact record looking up to an Account record in its AccountID field), allowing you to reference it in other flow elements and resources.
The filter criteria is based on values found on the specific record you’re getting, such as the ID or name of an account. Multiple criteria can be used, and the condition requirements can be set using “and,” “or,” or custom logic. When getting your criteria, the filter logic should be as specific as possible (such as an ID value), so that you only get the records you want to work with.
Get Records can be set to retrieve either the first record that meets the criteria, or all of the records that meet the criteria. Multiple records are stored together in a collection.
In the example below, this Get Record is retrieving the first account with a value of “Venn Technology” in the Name field and storing it for use in the flow.
Delete Records
The Delete Records element is used to delete records from the database. Similar to the Update Records element, you can either delete records stored in variables defined earlier in the flow, or specify the object and filter criteria needed to find the records you wish to delete. Similar to the Update Records element, the Delete Records element will delete all records that meet the filter criteria—make sure to be specific.
In this example, we use the Delete Records element to delete an account with the Id of “0014T000008zal9QAA.” By using the Id field in the filter, we ensure that only this specific account record is deleted.
Assignment Element
The Assignment element is one of the Logic elements, which means that it does not directly affect the contents of the Salesforce database. Instead, it is used to interact with records and resources within the flow by changing, adding, or subtracting the values of variables and fields. This is very useful for setting or changing record values before creating or updating them, and for using variables to perform logical functions.
Below, we use the Assignment element to change the StageName field of an opportunity to Closed Won and set the CloseDate field to today’s date with {!$Flow.CurrentDate}. This does not update the Account field in the database yet, but does set the values in preparation for the Data elements.
Decision Element
The Decision element is one of the most important elements in the Flow Builder, as it allows for the creation of multiple paths based on various criteria, allowing a single flow to output different results based on decision criteria.
When creating a Decision element, set the name and criteria for one or more outcomes. If the criteria is met in the flow, then the flow will follow the path for that outcome. If none of the criteria for the created outcomes are met, the “Default Outcome” is followed.
In this example, we create a Decision element that checks if the Opportunity record’s StageName field value is Closed Won.
If the Opportunity is Closed Won, the flow follows the “Yes, Opportunity is Closed Won” path to Create Contract. If the Opportunity is not Closed Won, the flow follows the Default Outcome and sends an email to the sales representative.
Tips and Tricks
Now that you know how to use the Data, Assignment, and Decision elements, here are some tips and tricks when using them.
Using a Decision after a Get Element
The Get Records element will not error out if it does not find anything with the filter criteria provided, but if later elements in the flow attempt to reference the record when there is not one, those elements may cause an error.
For this reason, unless you can ensure that your Get Records elements will find a record, it is a good idea to create a Decision element after your Get Records element to see if it found anything. Do this by checking if the variable from the Get Records element is not null, as shown below.
If the variable is null then the record was not found—the default path is followed and the flow ends. If records are found, the flow continues.
In this example, the flow checks for Opportunity Products, updates them if the flow finds any, and if none are found, the flow ends:
There may also be times when the requirements of your automation may change depending on if there is an existing record or not and, in those cases, you may want to check if the record is present. If the record is not present, check to see if there is an existing contract for an account. Update the contract if there is one and, if there isn’t, choose “Create Contract” instead.
Using Decision results later in the flow
The outcome of a Decision element is stored in the flow as a boolean (true/false) value that can be referenced later on in the flow by other decisions or formula resources.
This can be useful in various situations where a decision was made previously in the flow that you want to reference later.
Below you can see:
• The first decision checks the size of the account • The second decision determines if a new contract is needed • The third decision checks if a new contract was just created for a large account, thereby sending an email to a Sales Representative if it was
For more information on Salesforce Flows, check out our next blog post: Flow Element Basics Pt. 2 – Variables, Collections, and Formulas.
About the Author
Jonathan davis, subscribe for updates, filter by tags.
- Integration
- Life at Venn
- Sage Intacct
- Artificial Intelligence
FEATURED BLOG POSTS
Learn Salesforce with Anuhya Digital
What is Assignment in Salesforce Flow
In our previous blog post we had discussed about What is Sub flow in Salesforce flow .In these blog post we discuss about What is Assignment in Salesforce Flow
- 1 What is Assignment in Salesforce Flow
- 2 Introduction
- 3.1 Definition and Overview
- 3.2 Key Components of Salesforce Flow
- 4.1 Definition of Assignment
- 4.2 Role of Assignments in Flow
- 5.1 Variable Assignment
- 5.2 Collection Assignment
- 5.3 Resource Assignment
- 6.1 Step-by-Step Guide to Create Assignments
- 6.2 Best Practices for Creating Assignments
- 7.1 Real-World Examples
- 7.2 Industry-Specific Use Cases
- 8.1 Improved Efficiency
- 8.2 Enhanced Automation
- 9.1 Common Challenges
- 9.2 How to Overcome These Challenges
- 10.1 Optimization Techniques
- 10.2 Advanced Use Cases
- 11 Conclusion
Introduction
Salesforce Flow is a powerful tool that enables users to automate complex business processes within the Salesforce ecosystem. One crucial component of this tool is the concept of “assignments.” Understanding and utilizing assignments effectively can significantly enhance the efficiency and automation capabilities of your Salesforce org.
Understanding Salesforce Flow
Definition and overview.
Salesforce Flow allows users to create applications that automate complex business processes using a visual interface. This includes everything from simple workflows to advanced, multi-step automations that can integrate with other systems and services.
Key Components of Salesforce Flow
- Elements: Building blocks of a Flow, such as assignments, decisions, and loops.
- Resources: Variables, constants, formulas, and collections used within the Flow.
- Connectors: Define the path between elements in the Flow.
Definition of Assignment
In Salesforce Flow, an assignment is an element that sets the value of variables, collection variables, and record variables. Essentially, it’s used to store data temporarily within a Flow for processing and manipulation.
Role of Assignments in Flow
Assignments play a crucial role in ensuring data is accurately and efficiently managed within a Flow. They allow for dynamic data handling, enabling the Flow to perform actions based on variable values.
Types of Assignments
Variable assignment.
Variable assignments are used to assign a value to a variable. This can be anything from a string to a number or a Boolean.
Collection Assignment
Collection assignments allow for the manipulation of lists or collections of records. This is useful for operations that involve multiple records, such as bulk updates.
Resource Assignment
Resource assignments pertain to other resources like constants, formulas, and global variables.
Creating Assignments in Salesforce Flow
Step-by-step guide to create assignments.
Login to Salesforce Account
Click Gear icon Navigate to Setup
Search Quick find box in Flows
Click New flow
Select Screen Flow
Add elements in Assignment
fill details Save
Best Practices for Creating Assignments
- Use Descriptive Names: Ensure variable names are descriptive to avoid confusion.
- Minimize Hardcoding: Use variables and formulas instead of hardcoding values.
- Optimize for Performance: Limit the use of complex assignments in large datasets.
Use Cases of Assignments in Salesforce Flow
Real-world examples.
- Lead Routing: Assign leads to the appropriate sales representatives based on criteria.
- Opportunity Updates: Automatically update opportunity fields based on related record changes.
Industry-Specific Use Cases
- Healthcare: Assign patients to the appropriate care team based on their needs.
- Finance: Automate the assignment of financial tasks based on transaction criteria.
Benefits of Using Assignments in Salesforce Flow
Improved efficiency.
Assignments streamline data handling within Flows, reducing the need for manual intervention and enhancing operational efficiency.
Enhanced Automation
By automating data assignments, businesses can ensure that processes are consistent and reliable, leading to better outcomes and fewer errors.
Challenges and Solutions
Common challenges.
- Complexity: Managing multiple assignments can become complex.
- Performance Issues: Inefficient assignments can slow down the Flow.
How to Overcome These Challenges
- Simplify Assignments: Break down complex assignments into smaller, manageable parts.
- Optimize Performance: Regularly review and optimize your Flows for better performance.
Advanced Tips for Using Assignments
Optimization techniques.
- Batch Processing: Use batch processing for large datasets to improve performance.
- Efficient Data Handling: Use collection variables for bulk operations to reduce processing time.
Advanced Use Cases
- Conditional Assignments: Use decision elements to conditionally assign values.
- Dynamic Assignments: Create dynamic assignments that change based on real-time data inputs.
Assignments in Salesforce Flow are a powerful feature that, when used correctly, can greatly enhance the automation and efficiency of business processes. Understanding how to create, use, and optimize assignments is essential for any Salesforce administrator or developer.
We Want to more about What is Assignment in Salesforce Flow Click Here
What is the main purpose of assignments in Salesforce Flow?
Assignments in Salesforce Flow are used to set and manage the values of variables, enabling dynamic data handling within automated processes.
How do I create a variable assignment in Salesforce Flow?
To create a variable assignment, add an Assignment element in Flow Builder, set the variable, and define its value.
Can assignments in Salesforce Flow handle complex data?
Yes, assignments can handle complex data, including lists and collections of records, making them suitable for a wide range of use cases.
What are some common mistakes to avoid when using assignments?
Common mistakes include not using descriptive variable names, hardcoding values instead of using variables, and creating overly complex assignments.
How can I optimize assignments for better performance?
To optimize assignments, break down complex assignments, use batch processing for large datasets, and regularly review and optimize your Flows.
In our next blog post we will discuss about What is Decision Element in Salesforce Flow
2 thoughts on “ What is Assignment in Salesforce Flow ”
- Pingback: What is Sub flow in Salesforce flow - Learn Salesforce with Anuhya Digital
- Pingback: What is Decision Element in Salesforce Flow - Learn Salesforce with Anuhya Digital
Leave a Reply Cancel reply
Your email address will not be published. Required fields are marked *
Save my name, email, and website in this browser for the next time I comment.
JORDAN NELSON
Salesforce Flow Assignments
Updated: Dec 25, 2021
What Does This Post Cover?
- How to use the Assignment Element in Salesforce Flows
- Have you ever needed to assign a new value to an existing variable? YES?! Great - this use case was made just for you.
In this example:
We will be taking the assignment element and setting a new value (assigning) to an existing variable. Our made up business use case is the following: The account management team needs to be able to update the account with the client's favorite movie when needed. Create a solution that will allow the AM team to do this.
Since we have a video on this showing you step by step, this blog post will be primarily used to view the values we used in the video as a reference to rebuild.
#1 Account Button
#2 Assignment Flow
a. Get Records: "Find Account Info"
b. Screen: Screen1
c. Assignment: Assign New Values?
d.Update Records: Update Account
#3 Video Walkthrough
Check out the FULL video walkthrough to get more context here in the youtube video below 🎬🍿
CLICK TO WATCH VIDEO
Recent Posts
How to clean up your Salesforce
Salesforce Naming Conventions
- App Building
- Be Release Ready – Winter ’25
- Integration
- Salesforce Well-Architected ↗
- See all products ↗
- Career Resources
- Salesforce Admin Skills Kit
- Salesforce Admin Enablement Kit
- Career Paths ↗
- Trailblazer Career Marketplace ↗
- Trailblazer Community Online ↗
- Trailblazer Community Group Meetings ↗
Home » Article » Automate the Assignment and Removal of Permission Set Groups
Automate the Assignment and Removal of Permission Set Groups
In the first episode of Automate This!, a new livestream content series focused on all things automation, I presented a solution for automating the assignment and removal of permission sets . This blog post will cover a related solution, the automation of the assignment and removal of permission set groups. Don’t know what permission set groups are? Check out the Introducing the Next Generation of User Management: Permission Set Groups blog post for an overview.
Automation is for everyone, not just for your customers or end users but also for you as an admin. Let’s make this the year where we #WorkSmartNotHard by automating routine, repetitive tasks for ourselves so we can focus on those more value add tasks, like delivering new enhancements to our users!
As an admin, it’s important to be security-minded, ensuring your org is secure and your users have only the access they need to get their work done. Use our Security and Visibility Admin Configuration Kit to guide you toward a recommended solution for object-level security, field-level security, and record access.
Stop sticking Post-it notes on your computer to remind you to manually add and remove users from permission set groups. Get Salesforce to do the remembering for you! Use Flow Builder to automagically assign and remove permission set groups to/from a user as long as certain conditions are met.
Let’s walk through how our #AwesomeAdmin, Addison Dogster, completes the process and configuration work needed to automate this task.
Understand the object relationship
First, Addison creates a permission set group called Cloudy’s PSG, assigns a couple of permission sets (Export Reports and Edit Accounts) to the permission set group, and assigns the permission set group to herself. Then, she exports the records from the following objects using Data Loader.
Note: You must check the box for “Show all Salesforce objects” to see these objects.
Permission Set Group (PermissionSetGroup): This is the object that holds the high-level setup of a permission set group. In this object, you can get the Permission Set Group Developer Name (DeveloperName) and Permission Set Group ID (Id).
Permission Set (PermissionSet): Represents a set of permissions that’s used to grant more access to one or more users without changing their profile or reassigning profiles. PermissionSet has a read-only child relationship with PermissionSetGroup. Here, important fields are the permission set name (Label) and the permission set type (“Session” represents permission set group and “Regular” represents a permission set).
Permission Set Group Component (PermissionSetGroupComponent): This is a junction object that relates the PermissionSetGroup and PermissionSet objects via their respective IDs and enables permission set group recalculation to determine the aggregated permissions for the group. In this object, you can see the related permission set group (PermissionSetGroupId) and the permission sets associated to it (PermissionSetId).
Permission Set Assignment (PermissionSetAssignment): Represents the association between a User and a PermissionSet (which can be a permission set or permission set group). Here, the important fields are the assigned user (AssigneeId), the permission set the user is assigned to (PermissionSetId), and the Permission Set Group the user is assigned to (PermissionSetGroupId).
When Addison looks at the permission set assignment data, she sees that Jared Dunn’s user ID (005B0000007N5MQIA0) is assigned to two permission sets, one of which comprises of a permission set group. But when she looks at her user record, she only has the one permission set group and no permission sets assigned. So, what is this mystery permission set?
Addison enters the permission set ID “0PSB0000001HY2aOAG” into the URL after https://servername.salesforce.com/ or https://mydomainname.my.salesforce.com/ to see what this permission set is. She gets the following error:
“Insufficient Privileges
You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. For more information, see Insufficient Privileges Errors.”
Interesting. This must be a system generated/owned permission set.
Addison noticed that when she went back to Setup Home, there are two Cloudy’s PSG items listed in her Most Recently Used list. One is a permission set group and the other is a permission set:
It appears that when a new permission set group is created, there’s a system generated permission set created with the same permission set group name.
Now that Addison understands the data relationship with permission set group, permission set, and permission set assignment, she can move into automating the assignment/removal of a permission set group using a flow, which will look like this:
Review the overall process in Salesforce
Before Addison logs in to Salesforce and creates a new flow, the first step in creating automation is to understand the overall process. There are two parts to the process: adding a user to a permission set group and removing a user from a permission set group.
First, Addison reviews the steps to manually assign a permission set group to a user:
- Search for the user.
- View the user’s record.
- Navigate to the user’s Permission Set Group Assignments list.
- Click Edit Assignments .
- Select the permission set group from the Available Permission Set Groups list to add to the Enabled Permission Set Groups list.
Note: The user interface (UI) allows you to assign a permission set group only if it’s available in the Available Permission Set Groups list.
6. Click Save .
Addison will now review the steps to manually remove a permission set group from a user:
- Navigate (hover over) to the user’s Permission Set Group Assignments list.
- Locate the permission set group you want to remove and click the Del link.
Note: The UI only allows you to delete a permission set group if it’s already enabled for the user.
Addison’s automation (aka flow) needs to accommodate for these UI restrictions or else the flow will fail.
- Before Addison assigns a permission set group, she needs to ensure the user is not already assigned to the permission set group.
- Before Addison removes a permission set group, she needs to ensure the user is already assigned to the permission set group.
Document the configuration process
Before Addison logs in to Salesforce and starts building the automation in Flow, she gets out a piece of paper and a pencil. She’s found it helpful especially when she was just learning Flow, or otherwise working on a highly complex process, to think out the steps logically on paper before she gets her hands on a keyboard. It’s easier to make changes on paper than to have to refactor her configuration. No one has time for that! #WorkSmartNotHard
First, she needs to understand the criteria to auto assign or remove a permission set group from a user.
For Addison’s business requirements, as shown in the illustration below, when a new marketing user is added to Salesforce, Cloudy’s PSG permission set group will be assigned. If an existing user leaves the marketing department and moves into the operations division, Cloudy’s PSG permission set will be removed from that user.
As we document the business process, as illustrated below, for any new user or change to an existing user, we need to evaluate whether the new user is a marketing user or the existing user’s department was marketing and is now something else. Then, if it is a new marketing user, we would assign a permission set group. If the user was formerly part of the marketing department, then we would remove the permission set group.
Let’s take a closer look at the documented steps for assigning a new permission set group.
First, we need to identify the permission set group. We know it by name, but Flow needs to know the permission set group ID. We get the ID by looking at the details of the permission set group record. Here, we’ll follow best practices and find the permission set group record by its API or developer name, as this is less likely to change than the permission set group name/label.
But let’s say you can’t find the permission set group by that name. Perhaps you were given the wrong name. Essentially, without that permission set group record, your business process ends. We can’t do much else at this point.
When working with Flow, you need to put those safety verifications or guardrails in place to prevent your flow from failing. Visually in Salesforce Setup, you would be able to see in the UI whether the user is already assigned to the permission set group. Behind the scenes, your flow will look to see if there’s a permission set assignment record for the user and the permission set group the user is assigned to.
If the user does not have the permission set group, then the next step is to assign the permission set group to the user (or create the permission set assignment record). However, if the user already has the permission set group, no further action is needed. Your work is done.
The animated GIF below illustrates the process for assigning a permission set group. It takes it a step further by translating the steps into related Flow elements. This will be handy when we build our flow.
When we find records, we’ll use a Get Records element to find information about the permission set group. To determine whether the Get Records element found a permission set group record, we need to make a decision. Hence, we’ll use a Decision element. Next, to see if the user is assigned to the permission set group, we need to query the permission set assignment object, so we’ll once again use the Get Records element. Next, we need to determine whether the Get Records element found a permission set assignment record for that user and permission set group, which is done using another Decision element. Lastly, if the permission set assignment record is found, we’ll create a new permission set assignment record for the user-permission set group combination with a Create Records element.
Now, let’s take the scenario of removing a permission set group:
- Similar to the process of assigning a permission set group, we need to identify the permission set group to get the permission set group ID.
- Again, if we can’t find the permission set group, our work is done.
- We also need to put those safety verifications in place to prevent our flow from failing. Visually in Setup, you can see whether the user is assigned to the permission set group you wish to remove. Like the first scenario, you’re looking to see if there’s a permission set assignment record for that user and permission set group.
- If the user has the permission set group, then the next step is to remove (or delete the permission set assignment record). If the user does not have the permission set group, no action is needed.
When we find records, we’ll use a Get Records element to find information about the permission set group. To determine whether the Get Records element found a permission set group record, we need to make a decision. So, we’ll use a Decision element. Next, to see if the user is assigned to the permission set group, we need to query the permission set assignment object, so we’ll once again use the Get Records element. Next, we need to determine whether the Get Records element found a permission set assignment record for that user and permission set group, which is done using another Decision element. Lastly, if the permission set assignment record is found, we’ll remove the permission set assignment record for the user-permission set group combination with a Delete Records element.
We can design each process as its own process and its own flow, but did you notice what both processes have in common? There are four common steps between the two processes. An even better design would be to consolidate the steps so we’re not building the same steps again and again.
One more thing before we go into Flow Builder.
We must determine information we need (or our inputs) so Salesforce can automagically assign permission set groups to a user:
- Who is the user?
- What is the permission set group?
- What are we looking to do (in this case, assign or remove a permission set group)?
These three pieces of information will be stored as text values as three separate variables.
What’s a variable, you ask? A variable is a container that holds a piece of information for use somewhere later in the flow or to be passed off outside the flow. I think of it as a Tupperware container.
- The variable varUserId will hold the user ID.
- The variable varPermissionSetGroupDeveloperName will hold the API or developer name of the permission set group.
- The variable varPermSetGroupAction will hold the value “Add” or “Remove”, which reflects what we want to do with the permission set.
We’ll use the permission set developer name to find the permission set group ID, because #AwesomeAdmins do not hard code IDs in their automation. Hard-coding is never a best practice, no matter what you’re doing in Salesforce. Hard-coded references may cause issues when new functionality is released and make it difficult to troubleshoot problems when they arise. So don’t do it!
If we find the permission set group, we’ll store the ID in a variable called varPermissionSetGroupId. Otherwise, the variable will be empty, signifying no permission set group.
Another valuable piece of information we’ll get to within the process is whether the user is already assigned to the permission set group. We’ll hold this in a variable called varDoesUserHasPSG. If it’s true, we’ll store the assignee ID. Otherwise, the variable will be empty, signifying the user does not have a permission set group.
We have a total of five variables that will hold important information we’ll use to make informed decisions or to take action within the flow.
Now, let’s build our automation!
With that out of the way, let’s build this in Flow. Did you notice how long it took before we even logged in to Salesforce?! There’s a substantial thought process that needs to happen before we build our configuration.
Our process will be broken down into three flows: two record-triggered flows and an autolaunched flow. It begins with something that happens to a user record, when a new user is created, or an update is made to an existing user record. This translates into two record-triggered flows. One process handles whether the user is a new marketing user. The other process focuses on whether the user was previously part of marketing. Both will use the same process steps to handle the add or remove permission set group action. Remember the consolidated process design?
We’re going to build that consolidated assign/remove permission set group process as an autolaunched flow, which means this is a flow that will fire when something else triggers it. In our case, this will be triggered by one of two record-triggered flows. We will reuse the same autolaunched flow twice in our process—for the permission set assignment and permission set removal—and the flow will know what to do based on three input variables our record-triggered flow will pass to the autolaunched flow. When you reuse an autolaunch flow in another flow, it’s called a subflow. In this case, we’re building a componentized flow that can be reused anytime there’s a need to assign or remove a permission set group from a user. We build it once, maintain it once, and reuse it over and over again. #WorkSmartNotHard
In order for our record-triggered flows to call or invoke an autolaunched flow, we need to build the autolaunched flow first.
- First, select to create an autolaunched flow.
- Next, create five text variables.
The first text variable is varUserId. This will store the user ID passed from the record-triggered flow. Make this available for input.
- Resource: Variable
- Name: varUserId
- Data Type: Text
- Available for input: Checked
The second text variable is varPermissionSetGroupDeveloperName. This will store the permission set group API or developer name passed from the record-triggered flow. Make this available for input.
- Name: varPermissionSetGroupDeveloperName
The third text variable is varPermSetGroupAction. This will store the value of “Add” or “Remove” passed from the record-triggered flow. Make this available for input.
- Name: varPermSetGroupAction
The fourth text variable is varPermissionSetGroupId. This will store the permission set group ID when we query the permission set group object using the value in the varPermissionSetGroupDeveloperName variable.
- Name: varPermissionSetGroupId
Our last and fifth text variable is varUserHasPSG. This will store the assignee ID when we query the permission set assignment object for the user and permission set group and there is a value found.
- Name: varUserHasPSG
Our first Flow element is a Get Records. We’ll use the permission set group API or developer name to get the permission set group ID. If a record is found, we’ll store the permission set group ID in the variable varPermissionSetGroupId. If no record is found, we’ll set the variable to null. This is done by checking the box for “When no records are returned, set specified variables to null.”
- Name: Get PSG Id
- Object: Permission Set Group
- Filter: DeveloperName Equals varPermissionSetGroupDeveloperName
- How Many Records to Store: Only the first record
- How to Store Record Data: Choose fields and assign variables (advanced)
- Where to Store Field Values: In separate variables
- Select Variables to Store Permission Set Fields: Id → varPermissionSetGroupId
- When no records are returned, set specified variables to null: Checked
Next, we’ll use a Decision element to determine whether the Get Records element found a permission set group record. Our Found outcome checks to see if varPermissionSetGroupId has a value (that is, Is Null False—two negatives equal a positive). The default outcome is “Not Found”.
- Name: PSG Found
- Outcome: Found | varPermissionSetGroupId Is Null False
- Default Outcome: Not Found
To see if the user is assigned to the permission set group, we need to query the permission set assignment object with another Get Records element to find a record with the user and the permission set group. If a permission set assignment record is found, then we’ll take the assignee ID and store it in the variable varUserHasPSG. If there’s no record found, we’ll set the variable to null by checking the box for “When no records are returned, set specified variables to null.”
- Name: Lookup Permission Set Assignment
- Object: Permission Set Assignment
- Filter Permission Set Assignment Records:
- AssigneeId Equals varUserId
- PermissionSetGroupId Equals varPermissionSetGroupId
- Select Variables to Store Permission Set Fields: AssigneeId → varUserHasPSG
In our next step, we need to determine whether the Get Records element found a permission set assignment record for that user and permission set group using another Decision element. We have two outcomes: “Add to PSG – Not Assigned” and “Remove PSG – Assigned”.
As discussed earlier, before we can add a permission set group to a user, we need to ensure the user does not already have the permission set group or else the flow will fail. Here, we check that the varUserHasPSG variable has a null value (that is, Is Null True) and the varPermSetGroupAction is “Add”.
In order for a permission set group to be removed, the user must be assigned to the permission set. Here, we check that the varHasPSG variable has a value (that is, Is Null False—two negatives equal a positive) and the varPermSetGroupAction is “Remove”.
This decision puts the guardrails in place in the flow where these same guardrails are already in the permission set group UI.
- Name: Is User Already Assigned?
- Outcome #1: Add to PSG – Not Assigned | varUserHasPSG Is Null True AND varPermSetGroupAction Equals Add
- Outcome #2: Remove PSG – Assigned | varUserHasPSG Is Null False AND varPermSetGroupAction Equals Remove
If the permission set assignment record is found, and the varPermSetGroupAction is “Add”, then we’ll create a new permission set assignment record for the user-permission set group combination with a Create Records element where the AssigneeId field is set to the value in the variable varUserId, and the PermissionSetGroupId field is set to the value in the variable varPermissionSetGroupId.
- Name: Add User to PSG
- How Many Records to Create: One
- How to Set the Record Fields: Use separate resources, and literal values
- AssigneeId: varUserId
- PermissionSetId: varPermissionSetGroupId
Lastly, if the decision outcome is to remove a permission set group for the user, then we’ll delete the permission set assignment record for the user-permission set group ID combination using a Delete Records element. We’ll delete the permission set assignment record where the assignee ID equals the variable varUserId and the permission set group ID equals the variable varPermissionSetGroupId.
- Name: Remove PSG from User
- How to Find Records to Delete: Specify Conditions
- Filter Permission Set Assignment Records: AssigneeId Equals varUserId AND PermissionSetGroupId Equals varPermissionSetGroupId
Let’s save the autolaunched flow and name it “Assign or Remove a user from a Permission Set Group”.
Don’t forget to test it using the Flow debugger and activate the autolaunched flow.
With the modularized flow created, we now need to create our trigger to fire the process of assigning or removing permission set groups to/from a user. As mentioned earlier, we’ll use a record-triggered flow to trigger the autolaunched flow.
The first of the two record-triggered flows Addison builds looks like this. This simple, one-step record-triggered flow fires when a new marketing user is created or an existing user’s department is now marketing.
The second record-triggered flow fires when an existing user is no longer part of the marketing department.
Let’s walk through the configuration of the first record-triggered flow.
The record-triggered flow starts when a user record is created or edited and the user’s department is marketing. Since we’re calling our autolaunched flow from this flow, we’ll use the Actions element, so we select Actions and Related Records .
- Object: User
- Trigger the Flow When: A record is created or updated
- Department Equals Marketing
- When to Run the Flow for Updated Records: Only when a record is updated to meet the condition requirements
- Optimize the Flow for: Actions and Related Records
Next, we want to use an Action; specifically, we want to reference a subflow (the autolaunched flow) to add the permission set group to the user if they don’t already have the permission set group assigned.
- Subflow name: Assign or Remove a user from a Permission Set Group
- Set the variables as follows and toggle so the variable is included:
- varPermissionSetGroupDeveloperName: Cloudy_PSG (This is the API name for the permission set group.)
- varPermSetGroupAction: Add (We want to add a permission set group to the user.)
- varUserId: {!$Record.Id} (This is the record ID that fired off the record-triggered flow.)
Let’s save this record-triggered flow as “New Marketing User or User Updated to Marketing”.
Test both expected outcomes (new marketing user and an existing user who moved to marketing) and one where the user does not meet the entry criteria (that is, new user with a department not marketing) using the Flow debugger. Then, activate the flow.
Now, let’s build the second record-triggered flow.
This record-triggered flow starts when a user record is updated and the user’s department is not marketing and the user’s department has changed. Since we’re calling our autolaunched flow from this flow, we’ll use the Actions element, so we select Actions and Related Records .
- Trigger the Flow When: A record is updated
- Department Does Not Equal Marketing
- Department Is Changed True
- When to Run the Flow for Updated Records: Every time a record is updated and meets the condition requirements
Next, we need a Decision element to determine whether the user was previously part of the marketing department. For our outcome “Part of Marketing”, we need to look at the user record’s department field prior value to see if it was “Marketing”. The default outcome is set to “Not Previously Part of Marketing”.
- Name: Was the User Previously Marketing
- $Record__Prior>Department Equals Marketing
- When to Execute Outcome: If the condition requirements are met
- Default: Not Previously Part of Marketing
For the “Part of Marketing” decision outcome, we want to use an Action; specifically, we need to reference our autolaunched flow as a subflow to remove the permission set group from the user if they already have the permission set group assigned.
- varPermSetGroupAction: Remove (We want to remove a permission set group from the user.)
Let’s save this record-triggered flow as “User No Longer Part of Marketing”.
Test the expected outcome (an existing user who moved out of marketing) and one where the user does not meet the entry criteria (an existing user who was never part of marketing) using Flow debugger, and activate the flow.
As additional scenarios come up for automatically assigning or removing a permission set group, you can create a new record-triggered flow that invokes the autolaunched flow as a subflow. Build once, maintain once, leverage several times. #WorkSmartNotHard.
Now, it’s your turn. Automate the process for assigning/removing permission set groups in your org today!
- Salesforce Help: Permission Set Groups
- Trailhead Module: Flow Testing and Distribution
- Trailhead Module: Record-Triggered Flows
- Salesforce Architects Site: Record-Triggered Automation Guide
Jennifer W. Lee
Jennifer is a Lead Admin Evangelist at Salesforce and the host of our live streamed series Automate This! She is Flownatic, 8x certified Application Architect, Trailhead enthusiast, and Golden Hoodie recipient. Prior to joining Salesforce, Jen was a Koa customer, blogger (Jenwlee.com), founding co-host of Automation Hour, and a Salesforce MVP (2016-2021).
- Jen’s Top Winter ’25 Release Features | Be Release Ready
- Jen’s Top Summer ’24 Release Features | Be Release Ready
- Einstein for Formulas | Spring ’24
- Jen’s Top Spring ’24 Release Features
Related Posts
Advance Your Admin Career With Dev Fundamentals
By Kate Lessard | October 21, 2024
Ready to take the next step in your admin career but unsure where to start? Take a page out of my book and learn development fundamentals to jumpstart your abilities as an advanced admin and extend your Salesforce Platform knowledge. Several years ago, I was at a career tipping point. I felt solid in my […]
Elevate Automation Processes With Winter ’25 Flow Features | Be Release Ready
By Aleksandra Radovanovic | September 3, 2024
Winter ’25 is almost here! Learn more about some of the features coming to Flow and check out Be Release Ready to discover more resources to help you prepare for Winter ’25. General Flow enhancements With Winter ’25, we’re introducing several features that will streamline the flow creation experience and simplify the maintenance of existing […]
Core Responsibilities of a Salesforce Admin: Your Blueprint for Success
By Eliza Riley | August 21, 2024
As admins, you hold the keys to success for your users and companies to get the most out of Salesforce. You have the unique opportunity to build and manage trusted solutions that drive productivity and innovation through five core admin responsibilities: security, user management, data management, analytics, and a new core responsibility: product management. The […]
How To Trigger Assignment Rules In Flow
This article explains how to trigger Assignment Rules on Salesforce while creating a Case or Lead record in a Mule Flow.
As per the document SOAP API Developer Guide - AssignmentRuleHeader and Salesforce Operations a header AssignmentRuleHeader needs to be set while creating a Case or Lead record. This is an example.
- In this example, it sets AssignmentRule ID 01Q2v0000016nQeEAI while creating a Case record, so that the created Case will be assigned to a specific person or queue on Salesforce.
- The ID 01Q2v0000016nQeEAI can be retrieved by querying the AssignmentRule object on Salesforce. Alternatively, the ID that starts from 01Q... can be seen in the URL if you login to Salesforce then navigate Setup ==> Service ==> Case Assignment Rule then click a desired Assignment Rule
- Then it sets AssignmentRuleHeader in tag <salesforce:headers>
- Sample curl request for this example: curl -X POST 'http://localhost:8081/insertCase1' -H 'Content-type: application/json' --data '{"Status": "New", "Origin": "Phone", "Subject": "This is a Test Case"}'
Cookie Consent Manager
General information, required cookies, functional cookies, advertising cookies.
We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings. Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.
IMAGES
VIDEO
COMMENTS
Usage. To update the value of a variable, add an Assignment element to your flow. Specify the API name of a variable, an operator, and the value to use. To update the value of more than one variable in an Assignment element, click Add Assignment. For each row, specify the variable, the operator, and the value to assign.
Flow: How To Use "Assignment". Assignment is the equal sign of flow (As you see in the icon). If you want to change the value of your variables, you will have to do it through Assignments. Some important notes before we dive into the details of Assignments: 1. Assignment Cannot Update Data Directly. If you have read my introduction of flow ...
In this Salesforce Flow tutorial we'll explain the Salesforce Flow Assignment Element in depth, showing examples of a flow assignments to set field values, u...
In Salesforce Flow, an "Assignment" is a fundamental building block that helps you manage and manipulate data and allows you to assign values to variables. Variables store and organize data within a flow, and Assignments enable you to control and modify these values as the flow progresses. It's like giving instructions to the flow on how to ...
Decision Element. The Decision element is one of the most important elements in the Flow Builder, as it allows for the creation of multiple paths based on various criteria, allowing a single flow to output different results based on decision criteria. When creating a Decision element, set the name and criteria for one or more outcomes.
Connectors: Define the path between elements in the Flow. What is Assignment in Salesforce Flow Definition of Assignment. In Salesforce Flow, an assignment is an element that sets the value of variables, collection variables, and record variables. Essentially, it's used to store data temporarily within a Flow for processing and manipulation.
There are 3 main "building blocks" of any Flow: 1. Elements are the individual building blocks of the Flow. These perform logical actions such as assignments, decisions, or loops. There are also data elements that will query the database or commit record changes. 2. Connectors determine which element leads to which.
Learn what are assignment, decisions, and loop in lightning flow. Lear how to create/use Assignments, decisions, and loop in lightning flows. The video cover...
In this video we break down the Salesforce Flow Assignment Element
Salesforce Flow empowers Administrators and Declarative Developers to do some pretty powerful things in Salesforce. If you've been putting in the effort to learn Salesforce Flow and are already getting the hang of it, you may be looking to push your knowledge further to really master the tool. ... Assignments can also be used to add variables ...
Loading. ×Sorry to interrupt. CSS Error
Click the Copy Billing Address element and select Edit Element. Click + Add Assignment. In the Variable field, select Account from Get Account Data, then select Account Description. We set the account variable's Description field here because it's the variable that's changing. In the Operator field, select Add.
Autolaunched Flow. Autolaunched Flow is simply the set of actions that fire but instead of being triggered (by either record action, platform event, or on a schedule) this set of actions only fires when it is called by something outside of the original Flow. For example, Apex, another Flow, Process Builder (historically - don't use Process Builder now), or by REST API.
In this example: We will be taking the assignment element and setting a new value (assigning) to an existing variable. Our made up business use case is the following: The account management team needs to be able to update the account with the client's favorite movie when needed. Create a solution that will allow the AM team to do this.
In part twenty of our Salesforce Flow Builder tutorial series we continue building our before save record-triggered flow on the task object. We use an assign...
You can now use update elements in Record-Triggered flows to update the field values that triggered the flow regardless of whether that flow is set to run before-save or after-save. Before Summer '21, you had to use the assignment element to update these field values in a before-save situation. And this was very confusing for new flow ...
A Loop is a Salesforce Flow element that is used to iterate through a number of items in a collection variable. There are three main components of a Loop: Collection Variable: This is the Collection you want to loop through - the Collection contains multiple Variables, each of which you want to either assess or action.
Before Addison logs in to Salesforce and creates a new flow, the first step in creating automation is to understand the overall process. There are two parts to the process: adding a user to a permission set group and removing a user from a permission set group. ... Click Edit Assignments. Select the permission set group from the Available ...
http://studysalesforce.com/ [Find all Salesforce Video links]Udemy : Enroll Salesforce Admin Certification Masterclass : https://kadge.io/admin201Udemy : Enr...
As per the document SOAP API Developer Guide - AssignmentRuleHeader and Salesforce Operations a header AssignmentRuleHeader needs to be set while creating a Case or Lead record. This is an example. In this example, it sets AssignmentRule ID 01Q2v0000016nQeEAI while creating a Case record, so that the created Case will be assigned to a specific person or queue on Salesforce.
3. Set Up Salesforce Flows. In Salesforce, go to Setup, and search for Flows in the Quick Find box. Create a new Flow and choose Record-Triggered Flow. Define the conditions for triggering the Flow. For instance, you can trigger the flow when the product on an opportunity is identified as an enterprise or commercial sale.