Operation Details
Description: Return the list of work queues that are administered by the user but are not yet subscribed by any of the organizational objects and users. It also returns number of open tasks for each work queue.
Sterotype: nsmulti
SQL
SELECT
  DISTINCT wq.workQueueID,
  wq.name,
  COUNT(taskID)
INTO
  :workQueueID,
  :workQueueName,
  :taskCount 
FROM
  WorkQueue wq 
  LEFT  JOIN
  TaskAssignment ta 
  ON wq.workQueueID = ta.relatedID 
  AND ta.assigneeType = :assigneeType 
WHERE 
wq.administratorUsername = :relatedName AND
wq.workQueueID NOT IN (select DISTINCT ws.workQueueID from WorkQueueSubscription ws)

GROUP
  BY wq.workQueueID,
  wq.name 
ORDER BY wq.name