Operation Details
Description: Returns the count of assigned tasks for the work queue assignee type, the organizational unit subscriber type and by task ID and user name.
Sterotype: ns
SQL
SELECT
  COUNT(*)
INTO
  :numberOfRecords 
FROM
  TaskAssignment ta 
WHERE ta.assigneeType = :assigneeType 
  AND ta.taskID = :taskID 
  AND ta.relatedID IN 
  ( 
  SELECT
    DISTINCT wqs.workqueueID 
  FROM
    Users u ,
    PositionHolderLink ph ,
    Position p ,
    Job j,
    WorkQueueSubscription wqs 
  WHERE u.userName = :userName 
    AND u.userName = ph.userName 
    AND ph.positionID = p.positionID 
    AND p.jobID = j.jobID 
    AND ph.recordStatus = :recordStatus 
    AND wqs.subscriberType = :subscriberType 
    AND wqs.subscriberID = j.jobID
    AND :currentDate >= ph.fromDate 
    AND 
    (
      :currentDate <= ph.toDate 
      OR ph.toDate IS NULL 
    ) 
  )