Operation Details
Description: Returns the details of tasks that are assigned to a specified external user and that are due within the specified time period. The tasks may be assigned directly to the specified external user or be present on a work queue that the external user is subscribed to. The search criteria allow for the details of reserved tasks, assigned tasks or all of the tasks to be returned. The results are ordered by the due date, earliest first.
Sterotype: nsmulti
SQL
SELECT
  t.taskID,
  t.priority,
  t.reservedBy,
  e.userName,
  t.assignedDateTime,
  w.deadlineTime,
  t.wdoSnapshot,
  t.overflowInd,
  t.versionNo
INTO
  :taskID,
  :taskPriority,
  :taskReservedByUserName,
  :taskReservedByFullUserName,
  :taskAssignedDateTime,
  :taskDeadlineDateTime,
  :wdoSnapshot,
  :overflowInd,
  :versionNo 
FROM
  Task t 
  
  LEFT OUTER JOIN
  
  ExternalUser e 
  ON (t.reservedBy = e.userName),
  WorkflowDeadline w 
WHERE t.taskID = w.taskID 
  AND w.deadlineTime >= :fromDeadlineDateTime 
  AND w.deadlineTime < :toDeadlineDateTime 
  AND t.taskID IN 
  ( 
  SELECT
    taskID 
  FROM
    TaskAssignment ta 
  WHERE ta.relatedName = :userName 
    OR 
    (
      ta.relatedID IN 
      ( 
      SELECT
        workQueueID 
      FROM
        WorkQueueSubscription wq 
      WHERE wq.userName = :userName 
      ) 
      AND ta.assigneeType = :workQueueAssigneeType 
    ) 
  ) 
  AND 
  (
    :allTasksInd = '0' 
    OR 
    (
      t.reservedBy IS NULL 
      OR t.reservedBy IS NOT NULL 
    ) 
  ) 
  AND 
  (
    :allReservedTasksInd = '0' 
    OR t.reservedBy IS NOT NULL 
  ) 
  AND 
  (
    :allAssignedTasksInd = '0' 
    OR t.reservedBy IS NULL 
  ) 
ORDER BY deadlineTime ASC