Operation Details
Description: Returns the unreserved task identifier based on assignee name, the priority and nearest assigned date. There may be more than one record matching the search criteria as system generated tasks could have the same assigned date time.
Sterotype: nsmulti
SQL
SELECT
  t.taskID,
  t.versionNo
INTO
  :taskID,
  :versionNo 
FROM
  TaskAssignment ta,
  Task t 
WHERE 
  (
    :searchByRelatedIDInd = '0' 
    OR ta.relatedID = :relatedID 
  ) 
  AND 
  (
    :relatedName IS NULL 
    OR ta.relatedName = :relatedName 
  ) 
  AND ta.assigneeType = :assigneeType 
  AND ta.taskID = t.taskID 
  AND t.reservedBy IS NULL 
  AND t.priority IS NOT NULL
ORDER BY t.priority ASC,
  t.assignedDateTime ASC