[SalesForce] How to assign task to Case Owners without breaking on a queue owned case

Currently I have a process builder flow that is built to assign a task to the case owner when a case comment is added by someone other than the case owner. 90% of the time this works great, but when the case is owned by a queue rather than a user, my process builder breaks when attempting to assign the task, as it sees the queue id as an incorrect ID when expecting a user ID.

Given that this is a process builder and not an apex function, I am not sure if there is a good way to dynamically check each case and somehow differentiate between the owner being a queue vs the owner being a user. I had considered making another block on my process builder, one for assigning to user and one for assigning to queues, but I am not sure how to differentiate between them and I am also not sure if you can even assign a task to a queue at all.

Any help would be appreciated. I've posted a couple screenshots of the process builder below.

Condition

Action

Best Answer

You cannot assign a Task to a Queue.

In your PB, if you can identify a Case that is still assigned to a Queue, then you can choose a different User altogether to whom the Task can be assigned. And this is what I understand is, you need a way to distinguish the owner type.

I have limited experience around Process Builder, but the below approach should help you to distinguish between the owner (queue vs. user) for a Case.

To identify an Owner if it's a Queue or an Owner, you can create a simple formula on your Case object and then utilize that formula in your PB to verify and take further steps accordingly. Your formula let's say is named as IsOwnerQueue which returns a type checkbox, the formula would be as:

Owner:Queue.DeveloperName = "<Your Queue Name>"

So if the Case is assigned to any Queue, this will always be true. And then in your PB, you could verify if the value of the field IsOwnerQueue is true, then assign the Task to another User.

You could use this field elsewhere if you need to verify the owner on the Case utilizing this field.


But, as David suggested in the comments, if you only need it on a PB, then you can utilize the condition to verify if Owner Id Starts with 500, thus signifying that the Owner is a User without the change on the Object.