[SalesForce] How to determine if the case owner is a user or queue in process builder

I'm using the process builder to create a task and assign it to the case owner. If the case owner is a queue then creating the task fails with the following error:

FIELD_INTEGRITY_EXCEPTION: Assigned To ID: id value of incorrect type

While this scenario will likely never happen I'd like to address the possibility by determining if the owner is a user or queue and only attempt to create the task if owned by a user.

I've tried various conditions, but none of them have worked. As an example:

[Case].Owner:Queue.OwnerId Is Null = True

This criteria doesn't work because the process builder will fail if the owner actually is a user (the 99.999% use case). The failure message is:

The flow failed to access the value for myVariable_current.Owner:Queue.OwnerId because it hasn't been set or assigned.

It seems like I'm stuck. I can't access queue owner information if the owner is a user, and vice-versa I can't access user owner information if the owner is a queue.

How can I safely determine if the owner is a user or a queue?

Best Answer

Just check the first three digits of the OwnerId field (the key prefix for the Id). You can use a formula criterion here.

Is owned by User:

BEGINS([Case].OwnerId, "005") 

Is owned by Queue:

BEGINS([Case].OwnerId, "00G")