Operation Details
Description: Returns all the tasks that are assigned to the Job where user is part of.
Sterotype: nsmulti
SQL
SELECT
  ta.taskID,
  t.assignedDateTime,
  t.wdoSnapshot,
  j.name,
  w.deadlineTime,
  t.priority,
  t.status,
  t.versionNo
INTO
  :taskID,
  :assignedDateTime,
  :subject,
  :assignedTo,
  :taskDeadlineDateTime,
  :taskPriority,
  :status,
  :versionNo 
FROM
  TaskAssignment ta,
  Job j,
  Task t 
  
  LEFT OUTER JOIN
  
  WorkFlowDeadLine w 
  ON w.taskID = t.taskID 
WHERE ta.taskID = t.taskID 
  AND t.status NOT IN( :taskCompleted, :taskClosed) 
  AND ta.relatedID = j.jobID 
  AND ta.assigneeType = :assigneeType 
  AND t.reservedBy IS NULL 
  AND ta.relatedID IN 
  ( 
  SELECT
    DISTINCT j.jobID 
  FROM
    Users u,
    PositionHolderLink ph,
    Position p,
    Job j 
  WHERE u.userName = :relatedName 
    AND u.userName = ph.userName 
    AND ph.positionID = p.positionID 
    AND j.jobID =p.jobID 
    AND 
    (
      :searchByRelatedIDInd = '0' 
      OR j.jobID = :relatedID 
    ) 
    AND ph.recordStatus = :recordStatus 
    AND :currentDate >= ph.fromDate 
    AND 
    (
      :currentDate <= ph.toDate 
      OR ph.toDate IS NULL 
    ) 
  )