20.14.13 Troubleshooting Tasks

Methods to troubleshoot issues with tasks and the approvals component.

Troubleshooting Tasks

Problem Solution
Encountering Error ORA-20987: APEX: Not authorized for Task operations like complete_task, release, delegate, cancel_task, etc

Confirm the user name case in APEX_TASKS_PARTICIPANT and the user name case for the log in name are identical.

APEX users are saved in uppercase (USER). Potential owners specific in the task definition should be specified in uppercase.

Many of the authorization exceptions are false alarms due to incorrect case.

Approving a task through DB Scheduler Job is throwing a Task Not Found error.

When you use a DBMS Scheduler job to run apex_approval or apex_human_task APIs, the tasks are not in the user session, and cannot be found.

To resolve this error, create a valid APEX session in the job using apex_session.create_session() that passes the name of the approver as the user name and then calls the approve_task API.
PROCEDURE CREATE_SESSION (
p_app_id IN NUMBER,
p_page_id IN NUMBER,
p_username IN VARCHAR2,
p_call_post_authentication IN BOOLEAN DEFAULT FALSE );

After running create_session, you can call the apex_approval or apex_human_task APIs to approve or reject the task.

Task not expiring after setting the due date using apex_approval.set_task_due or apex_human_task.set_task_due

APEX has a scheduled job that checks once an hour for tasks past the due date. Expired tasks do not show as expired until the scheduled job runs.

You can trigger the scheduled job manually by running APEX_APPROVAL.HANDLE_TASK_DEADLINES or APEX_HUMAN_TASK.HANDLE_TASK_DEADLINES. Run this API to confirm your task goes to the expired state as specified in the expiration policy of the task definition. This is convenient for testing task expiration policies without waiting for the background job to run.

APEX$TASK_ID substitution string does not work when used in the Actions SQL Query in the Edit Task Definitions page

You cannot use APEX$TASK_ID in the action source because the ID is generated only after the task is created. This is a known bug that is planned to be fixed in an upcoming release.

As a workaround, use the APEX$TASK_PK substitution string wherever possible.