‘Error occured.System.Exception: Can not create the routing rule item as selected queue is not of entity type…’ Solved

By | February 16, 2022

Introduction:

While working with case entity and queue entity in the Customer Service Hub app we encountered an issue which states that we can only route to Entity type queue.
After investigating, we found that this issue arises due to OmniChannel Apps installed in Dynamics 365 CRM environment.

What is the issue?
We created a case entity record in the Customer Service Hub and while adding this record into queue we encountered an issue stating that we can only route to Entity Type queue as shown in below screenshots:

OmniChannel

OmniChannel

Error Description: “Error occured.System.Exception: Can not create the routing rule item as selected queue is not of entity type. You can only route to Entity type queue. at Microsoft.Dynamics.OmnichannelBase.Plugins.PreOperationOCQueueRoutingPlugin.Execute(IServiceProvider serviceProvider)”

After investigating more to resolve this issue we found that the issue has occurred due to the OmniChannel Apps installed in Dynamics 365 CRM environment.

In Queue Entity there’s a field named Queue Type (msydn_queuetype), but by default this field is not on the Queue Entity Form and its default value is “Messaging”.

This field comes with OmniChannel and it was not previously present in Dynamics 365 CRM.

To add the records in the queue manually or automatically, the queue type value should always be “Entity”.

To resolve the above issue we need to add the Queue Type field on the Queue Entity form and set its value to “Entity” instead of “Messaging”.

To add this field on the form, follow the steps given below:

1. Go to Advance Setting -> Customization -> Customize the System.

OmniChannel

2. In Components -> Expand Entity -> Expand Queue -> Open the Main Queue Form.

OmniChannel

3. It will open the Main Queue Entity Form. Drag and add the Queue Type field on the Main Form as shown in below screenshot:

OmniChannel

4. You can check the properties of the field and the default value of the field by double clicking on the field, it will open the Field Property window.
Here, go to Details Tab -> Click on Edit Button.

OmniChannel

5. It will open the Field Information Window. Scroll down and you can see the default value of the Queue Type Field.

OmniChannel

As you can see in the above screenshot the default value of the Queue Type is “Messaging” which causes the issue while adding the Case Entity record into the Queue.
6. After adding the field on the Queue Entity Form whenever we create any Queue we need to keep the Queue Type value as “Entity” so that we can add other entities records into that Queue without any issue.

OmniChannel

Now whenever we add any other entity records into this queue it will be successfully added into the queue.

OmniChannel

7. It will open the Add to Queue window. Here, select the queue which you have just created which has “Entity” as Queue Type.

OmniChannel

This time it will be successfully added to Queue without giving any error message. To check whether the Case record is successfully added to Queue or not you can refresh the timeline and it will show the Post Message on timeline that the record was added into the Queue.

OmniChannel

Conclusion:

If OmniChannel Apps is installed in CRM environment, then while adding the entity records into the queue, ensure to set the Queue Type of the Queue to “Entity”.