Operation Details
Description: Returns a list of task details for the specified external user. The list of tasks returned may be reserved, unreserved or all of the tasks assigned to the specified external user depending on the search criteria.
Sterotype: nsmulti
SQL
SELECT
  t.taskID,
  t.priority,
  t.reservedBy,
  e.fullName,
  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) 
  
  LEFT OUTER JOIN
  
  WorkflowDeadline w 
  ON (t.taskID = w.taskID) 
WHERE 
  (
    t.taskID IN 
    ( 
    SELECT
      taskID 
    FROM
      TaskAssignment ta 
    WHERE ta.relatedName = :relatedName 
    ) 
    OR 
    (
      t.taskID IN 
      ( 
      SELECT
        taskID 
      FROM
        TaskAssignment ta 
      WHERE ta.assigneeType = :assigneeType 
        AND ta.relatedID IN 
        ( 
        SELECT
          workQueueID 
        FROM
          WorkQueueSubscription wq 
        WHERE wq.userName = :relatedName 
        ) 
      ) 
    ) 
  ) 
  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 
    ) 
  )