Route Cases automatically using Power Automate flow 

In Dynamics 365 Customer Service, cases can be routed to agents without manual intervention using routing rules. However, there could be certain scenarios where automatic routing needs to be delayed to execute the necessary business logic before case assignment is performed.

Our cases are created in Portals, and a default customer is set upon case creation. The actual customer is defined by a Power Automate flow after the case is created. The routing rules, which are expected to assign the case owner based on the case’s customer, run before the Power Automate flow, leading to data discrepancies.

In these scenarios, automatic case routing can be disabled at the time of case creation and applied later using a Power Automate flow. Here’s how it can be implemented.

    1. Automatic routing is triggered only when the “Route Case” field is set to “Yes.” For cases created using custom processes, the value is defaulted to “Yes” and is always read-only, as shown in the screenshot below.

2. So, the ‘Route Case’ field needs to be set to ‘No’ upon case creation to disable automatic case routing. Since our cases are created in Portals, the field is set to ‘No’ on the Portal case form using JavaScript.

In Dynamics 365, the field value is set to ‘No’ on the case form, as shown in the screenshot below, which prevents automatic case routing from being triggered.

3. After the customer is set, case routing in our scenario is implemented by calling the ‘msdyn_ApplyRoutingRuleEntityRecord’ action from Power Automate, as shown below.

The ‘Target’ refers to the case entity, i.e., incidents (using the GUID of the case).

The action can also be triggered using JavaScript, as shown in the screenshot below.

P.S. the ‘msdyn_ApplyRoutingRuleEntityRecord’ action can be applied to any entity that has an active routing rule.

We will continue to share more exciting topics, so please stay connected with us and keep reading.