You need to sign in to do that
Don't have an account?
mlundwall
Complex SOQL Select
Hi,
I have the OwnerId of a Case and need to figure out if it is a Id of a user or Queue. I could do this with two select queries but would like to do it in just one.
How do I write that?
You can actually use Owner.Type as a value as well. It will return a string of the appropriate type (i.e. "User" or "Group"). It's used like this:
From a trigger, for example, caseids might be Trigger.newMap.keySet().
All Answers
Hi
You can try in this way like
Queuesobject[] q=[select queueid from queuesobject];
Case[] Cs=[select id,ownerid from Case where ownerid=:UserInfo.getUserid() or ownerid = : q[0].queueid];
From this using single query you can retrieve the ownerid if it is user or of queue.
Perfect thank you I will have a look at it.
Hi
Please mark it as a solution if it resolves your problem,so that it will be helpful for others.
Thankyou
You can actually use Owner.Type as a value as well. It will return a string of the appropriate type (i.e. "User" or "Group"). It's used like this:
From a trigger, for example, caseids might be Trigger.newMap.keySet().
Thanks worked perfectly, it wasn't that complex after all...