How Rules are sorted on the Rules page has significant importance. Rules execute based on the Trigger from a particular event, and If an event matches a Rule Trigger, then the rest of the Rule (Conditions and Actions) are evaluated and applied. Because you can have multiple Rules in place, you can create an order of priority in which you can decide which Rule takes precedence before the second, third, fourth (and so on) Rule.
How 'Sort Order' is configured
The Sort Order field only appears after a new Rule is saved. Edit the Rule to see the field. The Sort Order number is automatically added based on the number of Rules you currently have. For example, if you have 30 Rules, a newly added Rule will have "31" in the Sort Order field.
A Rule with a Sort Order of "1" appears at the top of the list and is evaluated first for every event.
You can also change the sort order by dragging and dropping a Rule on the Rules page. The Rule on top of the list is "1" in the sort order.
How Rules are evaluated
Events are evaluated against the entire list of Rules, starting with the first Rule on top of the list, all the way to the end but excluding any Rules that have been deactivated. Keep in mind that all Rule Conditions are evaluated at once. Only then will Actions be executed for the Rules that have matched. This means it evaluates all Rules + executes all Rules, not evaluate Rule 1 + execute Rule 1, evaluate Rule 2 + execute Rule 2, etc.
In the sample below, there are seven Rules for this organization. Let's say an applicable event (like receiving a new email) happens; then the following Rules will be evaluated and vetted in this exact order all at once:
Rule 1 (New Conversation) - Evaluate
Rule 2 (Conversations older than five days) - Evaluate
Rule 3 (Mail Reassignment | No DH | Overdue) – Skip (the Rule and any related Actions ignored)
Rule 4 (Task Assignment | Away) – Evaluate
Rule 5 (Messaging Assignment | No DH | Agent logout) – Evaluate
Rule 6 (Communication with auto-reply) – Skip (the Rule and any related Actions ignored)
Rule 7 (Task Reassignment | No DH | Overdue) – Skip (the Rule and any related Actions ignored)
Actions (within the Rule) are completed when a Rule is evaluated, and a match is made. Even though Rule 3, 6, and 7 are sorted with priority, they won't be included in the evaluation process because they are deactivated.
Closing Conversations with Rules
Once a Conversation is closed by a Rule, no further actions are applied to that Conversation. This means Rules sorted after the 'Close Conversation' Rule will no longer apply. For example, if Rule 1 closes a Conversation and Rule 3 adds a Topic to a Conversation then Rule 3 would not be evaluated because Rule 1 executed. However, if the Rule sort order is reversed such that the Rule to add the Topic is in the first position, the Rule to add a Topic would be evaluated.
Duplicate Rules
Duplicate Rules are ignored. So if you have duplicate Rules that perform the same action, where those Rules are on the sort order dictate which one fires and which one is ignored. For example, if you have two Rules that apply a Topic to an email Conversation, the Rule with the higher sort order (closer to 1) fires.