Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

How can I create assignment rule on Account, Contact and opportunities objects?

I want to create assignment rule on standard objects (Account/contact/opportunity) I couldn't find, is it not possible to create assignment rule on Account/contact/opportunity objects ?

My Scenario - When the Account/contact/opportunity record Industry field value changed from "Agriculture" to "Electronics", the business wants the record owner to be automatically assigned from "AAA" to "BBB".

How can i achieve this scenario?

  • process-builder
  • field-update
  • assignment-rules

Sfmcprgmr's user avatar

  • Depending on the underlying need for your question, Territory Management may work for your use case. If you're interested, consider setting up Territory Management in a Sandbox to see how it works, and check out the documentation. –  sfdcfox ♦ Commented Jun 19, 2020 at 5:03

2 Answers 2

Assignment Rules are supported on the Lead and Case objects.

Assignment rules automate your organization’s lead generation and support processes. Use lead assignment rules to specify how leads are assigned to users or queues. Use case assignment rules to determine how cases are assigned to users or put into queues.

You can use either declarative or programmatic automation for this purpose on other objects, but you cannot use Assignment Rules.

David Reed's user avatar

  • which programmatic automation process I can easily accomplish for these objects? –  Sfmcprgmr Commented Jun 19, 2020 at 4:59
  • Programmatic automation means Apex triggers. If you don't want to write Apex, pick a business process automation feature . –  David Reed Commented Jun 19, 2020 at 5:02

This kind of use-case can be achieved with AppExchange apps such as SuperRoundRobin:

https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FR4MkUAL

edralph's user avatar

You must log in to answer this question.

Not the answer you're looking for browse other questions tagged trigger process-builder workflow field-update assignment-rules ..

  • The Overflow Blog
  • Is this the real life? Training autonomous cars with simulations
  • What launching rockets taught this CTO about hardware observability
  • Featured on Meta
  • Preventing unauthorized automated access to the network
  • Upcoming initiatives on Stack Overflow and across the Stack Exchange network...

Hot Network Questions

  • How should one deal with criticism from formal superiors (advisors, reviewers) when they have misunderstood the criticized aspect of the work?
  • Generate random lon/lat coordinate anywhere on the map
  • Are these superheroes plagiarised?
  • PCB design review of my line following robot
  • Is it possible to build a Full-Spectrum White Laser?
  • Belief in Teshuvah being a prerequisite
  • Reality Check - How possible is it for a single human to reach "Space Engineers" level of technological prowess?
  • How did Vladimir Arnold explain the difference in approaches between mathematicians and physicists?
  • Book about a homeless girl who volunteers at a shady facility for money
  • How can I seal the joint between my wall tile and bathroom countertop?
  • Mereological nihilism without simples?
  • Horror / Thriller film with a mother and her baby surviving after a virus has turned people into zombie-like killers
  • What happens when a car starts moving? The last moment the car is at rest versus the first moment the car moves
  • HoTT for the working mathematician (especially the homotopy geometer) - what is the current state?
  • In what Disney film did a gelatinous cube appear?
  • "Almost true": non-trivial claims that have exactly one counterexample
  • Why does Jupiter spin so fast but not the Sun?
  • Expected number of cards that are larger than both of their neighbors
  • Clarification in definition of neighborhood in Topology
  • Newbie with a grease gun - lacking a bleeder valve
  • What options does Bangladesh have to stop Sheikh Hasina from travelling using an Indian government supplied travel document?
  • Customize the man command's status prompt to show percentage read
  • Roll a die in 3D
  • Universal footprint for 16 bit ISA slot

salesforce assignment rules trigger

Interested in scheduling a demo or free trial? Contact us today.

salesforce assignment rules trigger

Salesforce Assignment Rules Deep Dive

  • July 7, 2022

What Are Salesforce Assignment Rules

Assignment rules are a standard feature in Salesforce used to automate the assignment of leads and cases. They can be a great alternative to manually assigning records. However, there are more than a few limitations you’ll want to be aware of. In this article we’ll discuss the benefits and limitations of Salesforce assignment rules so you can decide if they make sense for your organization. We’ll also share advice and guidance on how to effectively configure assignment rules.

The Benefits of Assignment Rules

Salesforce assignment rules are a powerful tool designed to streamline the distribution and management of leads and cases within an organization. By automating the assignment process, these rules ensure that leads and cases are instantly assigned to the most appropriate team members based on specific criteria such as product interest, priority, and geographic location. This target approach helps to accelerate response times, balance workload, improve team performance, and increase customer satisfaction. The use of assignment rules in Salesforce, therefore, represents a strategic advantage for businesses looking to optimize their sales and support workflows, ultimately driving growth and customer loyalty.

Limitations of Assignment Rules

While Salesforce assignment rules offer significant advantages, they also have limitations that organizations should be aware of:

  • Limited to leads and cases : One of the most significant limitations of Salesforce assignment rules is the inability to assign standard or custom objects beyond leads and cases. This restriction often prompts organizations to look for an alternative solution that can assign any object .
  • Lack of round robin assignment : They do not support round robin assignment, which is essential for most modern sales and support teams. Instead, each rule assigns records to a specific user or queue you designate.
  • Lack of workload-based assignment : They don’t consider the existing workload of team members, potentially leading to an uneven distribution of leads and cases. This can result in slow response times and employee burnout.
  • Lack of availability-based assignment : They don’t consider the availability of team members, resulting in leads and cases being assigned to team members that are away from work or otherwise unavailable.
  • Difficult to maintain : Assignment rules can quickly become difficult to manage—even for small teams with simple assignment logic. Here’s an example of what a small portion of a typical assignment rule looks like:

salesforce assignment rules trigger

Assignment rules can still be very useful despite these limitations. Continue reading to learn how assignment rules can be used to optimize your lead and case routing process.

How Assignment Rules Work

An assignment rule is a collection of conditional statements known as assignment rule entries. Each assignment rule entry contains one or more conditions and a user or queue to whom matching records will be assigned.

salesforce assignment rules trigger

The Sort Order field can be used to change the order in which assignment rules are executed. Leads and cases will be evaluated against assignment rule entries in order and assigned by the first assignment rule entry that matches.

salesforce assignment rules trigger

In the example above, we’ve prioritized our rules for Canada provinces (e.g. Ontario) higher than our country-wide Canada rule entry to ensure that leads from specific provinces don’t get assigned to the wrong person.

Next we’ll step you through how to actually create an assignment rule. 

How to Create Assignment Rules

You’ll need the “Customize Application” permission in order to manage assignment rules. If you don’t have this permission, contact your Salesforce administrator.

Ready to create your first assignment rule? Follow these steps:

  • Login to Salesforce.
  • Navigate to Setup .
  • Search for “assignment rules” in Quick Find and click either Lead Assignment Rules or Case Assignment Rules .
  • Click New to create a new rule.
  • Name your rule and then click Save . We recommend leaving the Active box unchecked for now. 

Now you’re ready to specify how leads or cases will be assigned.

  • Click on the rule you created.
  • Click New to create a rule entry.
  • Sort Order : this controls the order in which rules are executed.
  • Criteria : you can enter one or more filters to define which records should be assigned by this rule.
  • Owner : choose a user or queue to which records should be assigned. Alternatively you can check the Do Not Reassign Owner checkbox if this rule should not assign records.
  • (Optional) Select an email template for notifying users of assignments.
  • Click “ Save. ”
  • Repeat the above steps for any additional rule entries.

Activate Your Assignment Rule

You can follow these steps to activate your assignment rule:

  • Navigate to your assignment rule.
  • Click the Edit
  • Check the Active
  • Click Save .

Keep in mind that only one assignment rule can be active at a time. We’ll discuss how your active assignment rule can be used to assign records in the next section.

What Triggers Assignment Rules in Salesforce

There is often some confusion about how and when assignment rules run. There are a few different ways these rules can be triggered:

  • Creating a New Record : When a new lead or case is created, either manually or through an automated process, assignment rules can be triggered to assign the record to the appropriate user or queue.
  • Updating a Record : If a record is updated and meets certain criteria set in the assignment rules, this can also trigger the reassignment of the lead or case.
  • Web-to-Lead or Web-to-Case Submission : When leads or cases are generated through Salesforce’s web-to-lead or web-to-case features, assignment rules can automatically assign these incoming records.
  • Data Import : When importing data into Salesforce, you can opt to apply assignment rules to the imported records, ensuring they are assigned according to the established criteria.
  • API Creation or Update : Records created or updated via Salesforce’s API can also trigger assignment rules, depending on the configuration.
  • Manual Triggering : Users with the appropriate permissions can manually apply assignment rules to leads or cases, either individually or in bulk.

Understanding these triggers is essential to effectively utilizing assignment rules in Salesforce, ensuring that leads and cases are assigned to the right team members promptly and efficiently.

Tips and Tricks

  • It’s always a good idea to include a final rule entry with no conditions. This will be used to catch anything that didn’t match your rule criteria and assign it to a user or queue for review.
  • It’s also a good idea to include a rule entry that assigns junk (e.g. spam, test records, etc.) to a queue for review and deletion.
  • We recommend you test assignment rules in a sandbox before you add to your production org. However, keep in mind that assignment rules cannot be deployed from a sandbox to a production org.
  • Custom formula fields can help to simplify complex assignment rules. For example, rather than entering lengthy criteria (e.g. lists of states by region) you could create a formula field instead. This would reduce your criteria from “STATE/PROVINCE EQUALS IL,IN,IA,KS,MI,MN,MO,NE,ND,OH,SD,WI” to “REGION EQUALS Midwest”.
  • You can enable field history tracking on the owner field to track assignments made by your assignment rules.

Frequently Asked Questions

What happens to records that don’t meet salesforce assignment rule criteria.

These records will be assigned to whomever is designated as the default lead owner or case owner.

What are the different types of assignment rules in Salesforce?

Salesforce currently support lead and case assignment rules. Additionally, account assignment rules can be created as part of enterprise territory management.

What is the order of execution for assignment rules?

It’s important to understand exactly when assignment rules are run in relation to other events. For example, assignment rules are run after apex triggers and before workflow rules. See Salesforce’s Triggers and Order of Execution article for a comprehensive list of events and the order in which they’re executed.

How do you run assignment rules when creating or editing records using the REST API?

You can use the Sforce-Auto-Assign header when making REST API calls to control whether or not assignment rules run.

Salesforce assignment rules can be a valuables tool for many organizations. However, it’s important to understand the limitations. If you’re struggling with assignment rules it may be time to look at alternative solutions. Kubaru is a powerful automated assignment application for Salesforce. Check us out on the Salesforce AppExchange or contact us to schedule a demo.  

How to Calculate (and Reduce) Your Customer Acquisition Cost

Have you ever considered how much your company spends to obtain a single customer? If you’re not calculating customer acquisition cost (CAC) you may be reading the signals all wrong. Even when business seems to be booming, if it’s costing

Net Revenue Retention Explained: Increase Your Revenue Growth in 2024

Imagine you’re sailing the vast ocean of subscription-based business, where the winds of customer churn and revenue expansion constantly shift. In this unpredictable sea, there’s one compass that guides you: Net Revenue Retention (NRR). It’s not just a metric–it’s your

A Comprehensive Guide to Data Enrichment for B2B Sales Success

Imagine you’re at a party, and you spot someone you’d like to get to know. You have their name and a vague idea of what they do, but that’s about it. Now, what if you had a magic lens that

Contact us to schedule a demo today!

Schedule Demo

Fill out the form below and we’ll respond in a few minutes

* We take privacy seriously. We will never sell or share your personal information with anyone.

  • December 2020
  • November 2020
  • February 2020
  • January 2020
  • December 2019
  • Architecture
  • Artificial Intelligence
  • Aura Component
  • Community Cloud
  • Integration
  • Interview Questions
  • Process Builder
  • Recommandations
  • Uncategorised
  • Visualforce
  • Web Component
  • Entries feed
  • Comments feed
  • WordPress.org

SFDC Developers

Trigger assignment rules from apex

Automatically assign the leads or cases to users or queue using assignment rules when they are inserted via api or back-end apex logic..

salesforce assignment rules trigger

Being a Salesforce Admin or Developer, I assume you have setup Assignment rules for your projects to auto assign cases or leads to either queue or user based upon some criteria.

The active assignment rules can be automatically triggered by checking the “ Assign using active assignment rules ” checkbox under the properties section of the lead or case page layouts . This option is only available if there are active assignment rules present on either lead or case.

salesforce assignment rules trigger

This automation will only applicable if the records is created from Salesforce UI and not through backend, which means through apex or REST API. There is no option in DML statements to assign the owners based on active assignment rules as of now. You need to manually specify active assignment rule to auto assign cases to users/groups.

Explaination:

  • Instantiate Database.DMLOptions
  • User DMLOptions variable to assign assignment rule id queried by SOQL
  • Insert the case/lead record after configuration
  • If case/lead is matching the criteria of assignment rule, then it will automatically assigned to user or queue.

Efficient Ways to Call Apex Methods from LWC in Salesforce: Pros and Cons

Efficient Ways to Call Apex Methods from LWC in Salesforce: Pros and Cons

How to Create Modal Popups in LWC Salesforce: A Step-by-Step Guide

How to Create Modal Popups in LWC Salesforce: A Step-by-Step Guide

Difference between @Track, @api and @wire LWC decorators

Difference between @Track, @api and @wire LWC decorators

Useful salesforce plugins.

Order of execution

Salesforce Order of Execution

Workflows vs. Process Builders

Workflow Vs. Process Builder

About 30 mins

Learning Objectives

Case management tools in salesforce, plan for case automation, share case lists or workloads with queues, add automatic case assignment with rules, add automatic case escalation with rules, add automatic responses to customers with rules, more case management tools in salesforce.

  • Challenge +500 points

Looking for Help?

Expect a response within 24-48 hours from Help or the community.

Automate Case Management

After completing this unit, you’ll be able to:

  • Route case ownership with queues.
  • Assign cases automatically.
  • Escalate cases when necessary.
  • Respond to customers automatically.

Accessibility

This unit requires some additional instructions for screen reader users. To access a detailed screen reader version of this unit, click the link below:

Open Trailhead screen reader instructions .

Case management means organizing customer cases into one place and making sure they go to the right person, for the right answer, by the right time. Service Cloud does all that behind the scenes with automation tools. Service is easier, faster, and better with a little automation.

Maria checks out a few of the main case automation tools. She notices automatically is the key word.

Queues

Automatically prioritize your support team’s workload by creating lists from which specific agents can jump in to solve certain types of cases.

Assignment Rules

Automatically assign incoming cases to specific agents so that the right people work on the right cases.

Escalation Rules

Automatically escalate cases to the right people when the cases aren’t solved by a certain time.

Auto-Response Rules

Automatically send personalized email responses to customers based on each case’s details.

Graphic of a robot automating case processes.

Based on what the tools can do, Maria jots down some questions to ask Ursa Major Solar’s service team. The answers determine which tools Maria uses to automate case management.

Question

Answer

Tool

Do support agents work as a team on specific issues?

Yes, some agents work off a list of emails as they arrive from customers.

Queues

How is the support team structured?

We have Gold and Platinum support teams. Platinum support shares a workload.

Queues

or

Assignment Rules

Do support agents work on specific products or have special skills?

Some agents work on solar panel installation while others work on solar panel performance.

Assignment Rules

Do cases need to escalate to someone if they’re not solved by a specific time?

Yes, we can’t have customers waiting more than 5 hours to get their issues solved.

Escalation Rules

Should customers receive automatic responses?

Yes, we want customers to know that we received their issue and that we care about them.

Auto-response Rules

Based on Maria’s case automation planning, she knows that the Platinum Support team shares a workload of incoming cases. These cases are from customers who pay extra for the best service. To help these agents find and work off this list of cases from high-priority customers, Maria creates a queue. Here’s how she does it.

  • Click the setup gear icon and select  Service Setup .
  • From Service Setup, enter Queues in the Quick Find box, then select  Queues .
  • Click  New .
  • Type a Label and Name for the queue, such as  Platinum Support .
  • If you want the support agents included in the queue to receive an email when a new case arrives, leave Queue Email blank. Otherwise, type an email address to notify a person or persons with the email address when each new case arrives.

A screenshot of the Queues page in Service Setup.

  • Add members, including yourself, to the queue and save your changes. Now that the queue is created, let’s check it out as if we were support agents. We can get there with a few clicks.
  • Select the Service Console app from the App Launcher. Then click the  Cases tab.

A screenshot of the Cases tab with Platinum Support selected from the view dropdown.

While planning for case automation, Maria learns that she can assign incoming cases to one person, groups of people, or even queues. Since some support agents at Ursa Major Solar work on solar panel installation, she creates an assignment rule so that any case with a reason that includes “installation” is automatically assigned to them. This is what she does.

  • From Service Setup, enter Case Assignment Rules in the Quick Find box, then select  Case Assignment Rules .
  • Type  Solar Panel Installation and save your changes.

A screenshot of the Case Assignment Rules page in Service Setup.

  • In Sort Order , type  1 so that the entry we add is processed first. Typically, you’d create one assignment rule with many different entries, which are processed in chronological order. When a case matches an entry, it’s assigned without proceeding to other entries.
  • For entry criteria, select  Case: Case Reason equals Installation . One of the many useful things about case assignment rules is that you can determine how cases are assigned based on fields from records other than cases. For example, you can choose case assignment based on fields from accounts, contacts, assets, or users.
  • Add yourself as the User assigned to the rule entry. We assume you’re a support agent who’s an expert at solar panel installation.

A screenshot of the Case Assignment Rules page with a user and email template selected.

  • Save your changes.
  • Click Edit to mark the rule as Active, then save your changes. When you activate an assignment rule, it disables any other assignment rules in your organization, so make sure that your active rule includes all of the assignment entries that your support team needs.

Now any cases about installation issues are automatically assigned.

When planning case management with the service team, Maria learns that certain cases must escalate to the right person within 5 hours. A lingering customer case can ruin a big deal or tarnish Ursa Major Solar’s brand. Just like assignment rules, Maria can use escalation rules to specify criteria that automatically trigger an action on a case. For case escalation, she uses her org’s default business hours, which simply means the service team is available 24 hours a day, 7 days a week. She can change Business Hours later from Company Settings in Service Setup. Here’s how Maria sets the rule.

  • From Service Setup, enter Escalation Rules in the Quick Find box, then select  Escalation Rules .
  • Type Gold Support , then Click  Active and save your changes. Activating a rule deactivates any existing active rules.

A screenshot of the Escalation Rules page in Service Setup.

  • In Sort Order , type  1 so that the entry we add is processed first. In the real world, you’d create one escalation rule with many different entries, which are processed in chronological order. When a customer issue comes in and is converted to a case, it’s assigned based on the first entry it matches.
  • For entry criteria, select  Case: Status equals New . Similar to other rules, you can determine automatic case escalation based on fields from records other than cases.
  • Set business hours to your organization’s default 24/7 support.
  • Set that escalation times are based on when cases are created.
  • Save your changes, then  New to add an escalation action.

A screenshot of the Escalation Rules page with an escalation action set for five hours.

  • Auto-assign cases to you, and from  Notification Template , click the lookup icon to pick any template. At a real company, you’d assign cases to a support manager or team.
  • Select yourself as the user to notify, and from  Notification Template , click the lookup icon to add a template to see how this works. Save your changes.

Now any cases that haven’t been closed in 5 hours are assigned to the right person.

Note : To keep the Assign using active assignment rule box checked by default on cases, update the Layout Properties on case page layouts.

From Maria’s case automation planning, she knows the service team wants customers to receive a confirmation when their case is received. With auto-response rules, she can make sure each Ursa Major Solar’s customer knows that their voice is heard. She sets up response rules so that customers are automatically sent a personalized email when they ask for help. Here’s how she does it.

  • From Service Setup, enter Case Auto-Response Rules in the Quick Find box, then select  Case Auto-Response Rules .
  • Type Welcome to Support , then Click  Active and save your changes. Activating a rule deactivates any existing active rules.

A screenshot of the Case Auto-Response Rules page in Service Setup.

  • In Sort Order , type  1 so that the entry we add is processed first. In the real world, you’d create one response rule with many different entries, which are processed in chronological order. When a customer issue comes in and is converted to a case, it’s assigned based on the first entry it matches.
  • For entry criteria, select  Case: Case Origin equals email . Similar to escalation rules, you can determine the automatic response to send to a customer based on fields from records other than cases.
  • Add a name and email address to include in the From line of the email template to send to customers.

A screenshot of the Case Auto-Response Rules page with field criteria and email templates selected.

  • Save your changes and you’re done!

With basic case automation complete, the service team at Ursa Major Solar is looking forward to easier, faster service. But Sita and Roberto want to make the most of their Service Cloud investment. They wonder what other case management tools the team can use in the future.

Maria looks into more case management options. She jots down these discoveries to share.

Page Layout Editor

Customize a case page’s contents, like the fields and buttons that appear on the page, along with what is visible to whom. Additionally, customize the structure of the page, and the position of its components, with the Lightning App Builder.

Email Templates

Create email templates to save time and standardize communications sent to customers from cases. Automate information on emails with merge fields. Templates are automatically available to anyone in the org.

Entitlement Management

Provide the correct level of support for customers. Define, enforce, and track service agreements and service contracts as part of an overall support management process.

Omni-Channel

Manage support agents’ priorities and their capacity to take on work items so that they’re given only the number of assignments that they can handle. Route all assignments to the correct agents so that they no longer have to choose work assignments manually from a queue.

Macros

Help support agents automatically complete repetitive tasks on cases, such as selecting the right email templates, so that they can spend time doing more important things.

Quick Text

Create predefined messages for support agents, like greetings, answers to common questions, and short notes to insert in cases, emails, web chats, and more. Save time and standardize on messaging to customers.

Utilities

Give support agents quick access to productivity tools, like notes, history, softphones, and more in the footer of the console.

Sita and Roberto want to explore some of these tools when they return to the case management stage of their service journey. But for now, they’d like to jump ahead to the basics of digital engagement.

  • Salesforce Help : Set Up Queues
  • Salesforce Help : Assignment Rules
  • Salesforce Help : Set Up Escalation Rules
  • Salesforce Help : Set Up Auto-Response Rules
  • Salesforce Help : Lightning Experience Customization

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

COMMENTS

  1. Run Case Assignment Rule from Apex - Salesforce

    From a standard UI, a user can trigger assignment rules by simply checking the "Assign using active assignment rules" checkbox under the Optional section. The problem arises when your app needs to insert the Case from Apex and wants to trigger assignment rules.

  2. Set Up Assignment Rules - Salesforce

    View and Edit Assignment Rules. Auto-Response Rules. Define conditions that determine how leads or cases are processed. The rules assign leads and cases to the specified user or queue.Required Editions and U...

  3. Trigger Assignment Rules with Data Loader - Salesforce

    Trigger Assignment Rules with Data Loader. Assignment rules are usually triggered through the user interface when you create or update a record; this can make it difficult to get the assignment rules to trigger for already existing records, or records imported or updated through the API.

  4. Case Assignment Rules and Case After Update trigger

    I have Case assignment rules that changes the Case ownership with some specific user/queue(s) based on changes to Status value(s). But, whenever I change the Status value, and Save the record, my Trigger is kicking in.

  5. trigger - How can I create assignment rule on Account ...

    Use lead assignment rules to specify how leads are assigned to users or queues. Use case assignment rules to determine how cases are assigned to users or put into queues. You can use either declarative or programmatic automation for this purpose on other objects, but you cannot use Assignment Rules.

  6. Create Case Queues and Assignment Rules - Trailhead

    Learn how to set up and configure case queues and assignment rules to streamline your support system and effectively distribute cases to your team.

  7. Triggers and Order of Execution - Salesforce Developers

    If a workflow rule field update is triggered by a record update, Trigger.old doesn’t hold the newly updated field by the workflow after the update. Instead, Trigger.old holds the object before the initial record update was made.

  8. Salesforce Assignment Rules Deep Dive - Kubaru

    API Creation or Update: Records created or updated via Salesforce’s API can also trigger assignment rules, depending on the configuration. Manual Triggering : Users with the appropriate permissions can manually apply assignment rules to leads or cases, either individually or in bulk.

  9. Trigger assignment rules from apex » SFDC Developers

    Automatically assign the leads or cases to users or queue using assignment rules when they are inserted via API or back-end apex logic.

  10. Automate Case Management Tools | Salesforce Trailhead

    Learn how to automate case management with queues, assignment rules, escalation rules, and auto-response rules in Salesforce Service Cloud.