Operation Details
Description: Returns a count of all of the tasks reserved by the specified user for all of the work queues that the user is subscribed to. The assignee type is set to Work Queue in the SQL.
Sterotype: nsmulti
SQL
SELECT
  ta.relatedID,
  count(*)
INTO
  :workQueueID,
  :numberOfRecords 
FROM
  TaskAssignment ta 
WHERE ta.assigneeType = 'RL23' 
  AND ta.relatedID IN 
  ( 
  SELECT
    wq.workQueueID 
  FROM
    WorkQueue wq 
  WHERE wq.workQueueID IN 
    ( 
    SELECT
      workQueueID 
    FROM
      WorkQueueSubscription wqs 
    WHERE wqs.userName = :userName 
    ) 
  ) 
  AND ta.taskID IN 
  ( 
  SELECT
    taskID 
  FROM
    Task t 
  WHERE t.reservedBy = :userName 
    AND t.taskID = ta.taskID 
  ) 
GROUP
  BY ta.relatedID