How to Apply Case Assignment Rules in Flow

How to Apply Case Assignment Rules in Flow

The case object is a core part of the Salesforce platform. It helps manage and track customer issues and inquiries. You can use this standard object to handle support requests effectively. The case object acts as a central repository for recording and monitoring customer interactions. It allows you to streamline your customer service processes. In order to improve the support efficiency, it is important to assign cases to the right teams or individuals. Although you can manually assign the record, it is possible to use the standard case assignment rules as well. Case assignment rules determine how cases are assigned to users or put into queues.

When you create a new case record, you can just mark "Assign using active assignment rule" to run case assignment rules.

Checkbox to assign case using active assignment rule

However, if you are creating the case record using Salesforce Flow, there is no standard option to run the case assignment rules. This option exists just for lead assignment rules. Moreover, when you create a case using flow, you have to set the correct owner id. Otherwise, the system doesn't run the case assignment rules and assigns the case to the current user. If you really want to use the logic that you have in your assignment rule, you will have to build the same logic again in the flow.

Standard action to apply lead assignment rules

In this post, you can find a custom invocable action (Apex class) that runs case assignment rules for any case record that you want.

How to Use the Action

1- Install the action using the installation links below.

2- Add a new action to your flow and search for "Apply Case Assignment Rules", this is the name of the action that you installed.

Add Apply Case Assignment Rules Action

3- Give a name to the action and provide the id of the case record that you want to assign.

Assign case using the custom action

You can use this action in any flow type that supports the action element.

Here is a screen flow that clones a case record with its related records. It uses this custom action to assign the new case record. Read this post to learn how to create a flow to clone a record with its related records.

Apply Case Assignment Rules Example

Installation Links

Use this link to install in production or developer edition environments.

Use this link to install in sandbox environments.

25 Comments

      • Hi Yumi, I tried using this on a case after save flow as an immediate action on create and it doesn't work. However, if I add a scheduled path of 0 min after creation, it works.
        Do you know of this limitation?
        Thanks!

    • Hi Priyanshu,
      You are right. I just added it to the code and uploaded the package again.
      Can you please try with the new version?

  1. Is there a way to verify (in a flow decision), using a formula or some other way, if the "Assign using active assignment rule" is checked? I have a user case where the Assignment rules need to be triggered within the flow ONLY when the checkbox "Assign using active assignment rule" is checked, but I cannot find a way to do so. Any ideas?

    • "Assign using active assignment rule" is not a field on the object, so I think unfortunately it is not possible to get this information.

  2. Hey Yumi Ibrahimzade, Not working in production or can you please provide url for update version?
    Thanks in advance 🙂

  3. Thank you so much for this package. I just came across the need for this and then found your solution. It works exactly as expected.

    • You are welcome Andy. Here is the code:

      public class ApplyCaseAssignmentRules
      {
      @InvocableMethod (label='Apply Case Assignment Rules')
      public static void CaseAssign(List CaseId)
      {
      Database.DMLOptions dmo = new Database.DMLOptions();
      dmo.assignmentRuleHeader.useDefaultRule= true;
      dmo.EmailHeader.TriggerUserEmail = true;
      Case Cases=[Select id From Case Where Case.id in:CaseId];
      Cases.setOptions(dmo);
      update Cases;
      }
      }

  4. I am using this action in a trigger flow (After Save), but it's not working, I should a scheduled path if I wanted to work, any suggestions please ? Thank you

  5. I am trying to install in sandbox and getting this error: ApplyCaseAssignmentRulesTest: Method does not exist or incorrect signature: void startTest() from the type Test

1 Trackback / Pingback

  1. Integrating ChatGPT with Salesforce: A Real-Life Example

Leave a Reply

Your email address will not be published.


*