I am trying to understand an internal application in service cloud (I am new to salesforce itself) where cases are incoming from web-to-case, email-to-case and from chat as well. For assigning case to queues, they are using apex handlers and not case assignment rules.

I am wondering what can be possible reasons to use apex instead of case assignment rules?

Edit: Both the answers helped me out, thank you so much. The answer to this in my case was that assignment rules can only be created on specific objects like case/lead. We used apex to assign queues based on another custom object.

2 Answers 2


Not sure of your implementation details, but generally speaking, Assignment rules come with limits (per object limit, per org limit). I am not sure if your org is approaching or have already exceeded those limits, making the person to leverage custom code (something like object trigger)

Second reason could be that the person may have piggybacked certain business functionality alongwith assignment activity (e.g. assign the case to the rightful owner, look up external user id to salesforce user, update certain count, which may have a dashboard for users, make multi-object updates and so on). However, such scenarios, may be simplified and separated out.


The main reason is typically that an assignment rule can only have 300 entries, and you can only have one default rule. Even worse, there's a bug in the platform that allows you to save more than 300 entries, but it will only evaluate the first 300 before going to the default owner.

As an alternative, all of the API-based features could specify the AssignmentRuleHeader in order to get around the 300 rules/1 active rule problem. However, if any specific rule needs more than 300 entries, then you definitely need to go with Apex, nothing else will be suitable in those cases.

As a second reason, not every possible criteria can be specified. It'd be, at minimum, challenging to assign a case to a specific queue, but only on Tuesdays, otherwise it has to go to a separate queue. Or if you need to figure out "after hours" in order to handle the assignment differently. There's so many limitations that might cause a developer to say "yep, it's time to get some Apex."

Generally speaking, up until the limits are reached/complexity is reasonable, assignment rules are preferred, but when you need to go beyond those limits, Apex is easily the best way to handle large or complicated assignment situations.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .