function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
zero1578zero1578 

Differentiate between Group and User on Case Queries

I am trying to build a few S-Controls that can perform operations on cases.  I pull the Case OwnerId and and I can then query against the User object to get all the names.  The problem I am running into is when an OwnerId points to a Group (queue) it fails and ends up stopping the loop, setting all additional Owners to 'undefined'.
 
Is there a javascript function that can determine if the Id being passed in is a User or a Group Id and then pull the Name accordingly?
 
I dont really want to have to build an array of queries to check both for each value, and I dont really understand the logic for querying relationship fields in Salesforce yet, so that may be a possible solution if anyone knows how to query the Name field from the Case objects OwnerId field.
 
Any suggestions? :)
zero1578zero1578
I figured out a way to do this by checking the value and looping through the results, if it doesnt match one i search through the other and assign the value.