I'm working on an Oracle APEX application where I need to create an approval task with the following functionality:
- The task should have a default Actual Owner assigned.
- The Actual Owner should be able to delegate the task to any user from a predefined list of Potential Owners.
- However, if I add multiple Potential Owners at the start, one of them is required to claim the task first before they can delegate it, which I want to avoid.
Is there a way to configure the task so that the Actual Owner can directly delegate it to a Potential Owner without the need for an initial claim?
I'm working on an Oracle APEX application where I need to create an approval task with the following functionality:
- The task should have a default Actual Owner assigned.
- The Actual Owner should be able to delegate the task to any user from a predefined list of Potential Owners.
- However, if I add multiple Potential Owners at the start, one of them is required to claim the task first before they can delegate it, which I want to avoid.
Is there a way to configure the task so that the Actual Owner can directly delegate it to a Potential Owner without the need for an initial claim?
Share Improve this question asked Mar 18 at 17:16 Groot GoblinGroot Goblin 111 bronze badge 1- I'd suggest asking this question on the official oracle apex forum – Koen Lostrie Commented Mar 18 at 20:55
1 Answer
Reset to default 0It's not available out of the box, but you can achieve like this: first add an 'ACTUAL_OWNER' parameter to your task definition. Then, in actions tab, create a new action 'Claim Task', type 'Execute Code', on event 'Create', and use next code:
declare
l_session_id number := v('APP_SESSION');
l_page_id number := v('APP_PAGE_ID');
l_temp_session_id number;
begin
apex_session.create_session (p_app_id => :APP_ID,
p_page_id => 1,
p_username => :ACTUAL_OWNER);
l_temp_session_id := v('APP_SESSION');
APEX_HUMAN_TASK.CLAIM_TASK(:APEX$TASK_ID);
apex_session.delete_session(l_temp_session_id);
-- switch back to original session:
apex_session.attach (
p_app_id => :APP_ID,
p_page_id => l_page_id,
p_session_id => l_session_id );
end;
That's it. You can then create a task instance, providing the value for the actual owner. Then, upon creation, it will impersonate to the actual owner, call the CLAIM_TASK api, and you have it automatically assigned. The actual owner can immediately delegate to one of the other potential owners.
I haven't tried, but an alternative might be to impersonate to the Business Administrator, and call APEX_HUMAN_TASK.DELEGATE_TASK(:APEX$TASK_ID, :ACTUAL_OWNER)