7.18 GET_TASKS Function

This function gets the tasks of a user depending on the given context.

Context can be one of the following:

  • MY_TASKS - Returns all tasks where the user calling the function is either the Owner or one of the Potential Owners of the task.
  • ADMIN_TASKS - Returns all tasks for which the user calling the function is a Business Administrator.
  • INITIATED_BY_ME - Returns all tasks where the user calling the function is the Initiator.
  • SINGLE_TASK - Returns the task identified by the P_TASK_ID input parameter.

This function only returns data in the context of a valid Oracle APEX session. It returns no data in SQL Workshop.

Syntax

APEX_APPROVAL.GET_TASKS (
    p_context            IN VARCHAR2 DEFAULT apex_approval.c_context_my_tasks,
    p_user               IN VARCHAR2 DEFAULT apex_application.g_user,
    p_task_id            IN NUMBER   DEFAULT NULL,
    p_application_id     IN NUMBER   DEFAULT NULL,
    p_show_expired_tasks IN VARCHAR2 DEFAULT 'N' )
RETURN apex_t_approval_tasks pipelined;

Parameters

Table 7-11 GET_TASKS Parameters

Parameter Description
p_context The list context. Default is MY_TASKS.
p_user The user to check for. Default is logged-in user. Requires p_context set to MY_TASKS, ADMIN_TASKS or INITIATED_BY_ME.
p_task_id Filter for a task ID instead of a user. Default is null. Requires p_context set to SINGLE_TASK.
p_application_id Filter for an application. Default is null (all applications).
p_show_expired_tasks If set to Y the tasks returned include tasks which are in Expired state.

Returns

A table of tasks (type apex_t_approval_tasks) containing the following columns:

  • actual_owner varchar2(255)
  • actual_owner_lower varchar2(255)
  • app_id number
  • badge_css_classes varchar2(255)
  • badge_text varchar2(255)
  • created_ago varchar2(255)
  • created_ago_hours number
  • created_by varchar2(255)
  • created_on timestamp with time zone
  • details_app_id number
  • details_app_name varchar2(255)
  • details_link_target varchar2(4000)
  • due_code varchar2(32)
  • due_in varchar2(255)
  • due_in_hours number
  • due_on timestamp with time zone
  • initiator varchar2(255)
  • initiator_lower varchar2(255)
  • is_completed varchar2(1)
  • last_updated_by varchar2(255)
  • last_updated_on timestamp with time zone
  • outcome varchar2(255)
  • outcome_code varchar2(32)
  • priority number(1)
  • priority_level varchar2(255)
  • state varchar2(255)
  • state_code varchar2(32)
  • subject varchar2(1000)
  • task_def_id number
  • task_def_name varchar2(255)
  • task_def_static_id varchar2(255)
  • task_id number
  • task_type varchar2(8)

Example

select * from table ( apex_approval.get_tasks ( p_context => 'MY_TASKS', p_show_expired_tasks => 'Y') )