Editing a Task Definition
Edit Task Definition details from the Shared Components page, under the Workflows and Automations heading.
Example: Editing Task Definition Participants
Edit Task Definition Participants by accessing the Task Definition in the Shared Components page.
This example uses the Sample Workflows, Approvals, and Tasks application, which can be installed from the Gallery. In this example, suppose you want to add an authorization scheme for Business Administrator and exclude STEVE from Business Administrator and BO from Potential Owner.
To edit Task Definition Participants:
-
Select the Sample Workflows, Approvals, and Tasks app.
-
Navigate to the Task Definitions page:
-
On the Application home page, click Shared Components.
-
Under Workflows and Automations, select Task Definitions.
-
-
Click Job Change.
To add the Operations Team authorization scheme:
-
Under Participants, click Add Participant:
-
Participant Type - Business Administrator
-
Identity Type - Authorization Scheme
-
Authorization Scheme Value - Operations Team
-
To exclude specific users:
-
Under Participants, click Add Participant:
-
Participant Type - Excluded Admin
-
Identity Type - User
-
Value Type - Static
-
Value - STEVE
-
-
Under Participants, click Add Participant:
-
Participant Type - Excluded Owner
-
Identity Type - User
-
Value Type - Static
-
Value - BO
-
-
Click Apply Changes.
The Business Administrator is now managed by an authorization scheme. Steve cannot become a business administrator for these tasks, and Bo cannot become a potential owner. Job Change tasks that already exist do not change.
Example: Adding a Vacation Rule Procedure
Add a vacation rule by editing the Task Definition in the Shared Components page.
Note: This section describes adding a vacation rule procedure to a task definition. You can also add a vacation rule procedure to the application definition. If you add a vacation rule procedure to the application definition, the vacation rule applies to all tasks in the task definition.
Tip: A vacation rule defined at the task definition level overrides a vacation rule defined at the application level.
This example uses the Sample Workflows, Approvals, and Tasks application, which can be installed from the Gallery. In this example, suppose that Jane, a task participant, is on leave. When Jane is on leave, Scott takes responsibility for Jane’s approvals.
Before adding the vacation rule procedure, you must add the following procedure to the APEX workspace:
procedure alternate_job_approvers(
p_param in apex_human_task.t_vacation_rule_input,
p_result out apex_human_task.t_vacation_rule_result)
is
l_result apex_human_task.t_vacation_rule_result;
l_changes apex_human_task.t_task_participant_changes;
l_participants apex_human_task.t_task_participants;
l_new_participant apex_human_task.t_task_participant;
l_old_participant apex_human_task.t_task_participant;
l_has_changed boolean := false;
l_index pls_integer := 1;
begin
l_participants := p_param.original_participants;
for i in 1..l_participants.count loop
if l_participants(i).value = 'JANE' then
l_old_participant := l_participants(i);
l_new_participant.value := 'SCOTT';
l_new_participant.type := 'POTENTIAL_OWNER';
l_new_participant.identity := 'USER';
l_has_changed := true;
end if;
end loop;
if l_has_changed then
l_participants(l_participants.count + 1) := l_new_participant;
l_changes(l_index).old_participant := l_old_participant;
l_changes(l_index).new_participant := l_new_participant;
l_changes(l_index).change_reason := 'Jane is out on maternity leave';
end if;
l_result.participant_changes := l_changes;
l_result.has_participant_changes := l_has_changed;
p_result := l_result;
end;
For more information on adding a procedure, see Creating a Procedure in Oracle APEX SQL Workshop Guide.
To add a vacation rule procedure:
-
Select the Sample Workflows, Approvals, and Tasks app.
-
Navigate to the Task Definitions page:
-
On the Application home page, click Shared Components.
-
Under Workflows and Automations, select Task Definitions.
-
-
Click Job Change.
-
Under Participants, enter the vacation rule procedure name in Vacation Rule Procedure.
The procedure name should be in the format
[schemaName.[packageName]].procedureName. -
Click Apply Changes.
Scott is now an alternate participant for Jane.
Example: Editing Task Definition Parameters
Edit Task Definition Parameters by accessing the Task Definition in the Shared Components page.
This example uses the Sample Workflows, Approvals, and Tasks application, which can be installed from the Gallery. In this example, suppose that for Job Change requests, you want to display the old job title as well as the new job title on 2 - Task Details.
To edit Task Definition Parameters:
-
Select the Sample Workflows, Approvals, and Tasks app.
-
Navigate to the Task Definitions page:
-
On the Application home page, click Shared Components.
-
Under Workflows and Automations, select Task Definitions.
-
-
Click Job Change.
-
Under Parameters, click Add Row.
-
Static Id -
JOB -
Label -
Previous Job -
Data Type -
String -
Required -
Yes -
Visible -
Yes -
Updatable -
Yes
-
-
Click Apply Changes.
-
Go back to the application home page, and open 7 - Request Job Change in Page Designer.
-
Open the Processing tab, and expand the Submit Task process.
-
Under Parameters, select Previous Job.
-
Under Value, set the Type to
Item. -
Set the item to
P7_JOB. -
Click Save.
Now, when 7 - Request Job Change is saved, the Previous Job value will be stored.
-
Open 2 - Task Details in Page Designer, and confirm that the Details section contains the columns
PARAM_LABELandPARAM_VALUE.All visible parameters, including the new Previous Job parameter, are visible in the Details section of the Task Details page. Since the parameter is marked as updatable, the task details section has an Edit button to edit the task parameter when the logged-in user is the actual owner of the task.
To test this change, go to the Employees page, and request a new job change. After submitting the Request Job Change page, access the task details page through My Requests or Approvals Administration. Under the Details section, you can see both the new job and the previous job.
Example: Adding and Editing Task Definition Actions
Add and edit Task Definition Actions by accessing the task definition in the Shared Components page.
This example uses the Sample Workflows, Approvals, and Tasks application, which can be installed from the Gallery. In this example, suppose that you want to add an action that logs an event every time a task is complete.
This example requires a metrics table to be added to the Sample Workflows, Approvals, and Tasks app through the SQL Commands page of the SQL Workshop.
CREATE TABLE EBA_DEMO_APPR_METRICS(
ID NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY PRIMARY KEY,
TASK_DEF_STATIC_ID VARCHAR2(255),
OUTCOME_CODE VARCHAR2(32),
APPROVER VARCHAR2(255),
APPROVAL_DATE DATE,
DAYS_ELAPSED NUMBER
);
To add and edit Task Definition Actions:
-
Select the Sample Workflows, Approvals, and Tasks app.
-
Navigate to the Task Definitions page:
-
On the Application home page, click Shared Components.
-
Under Workflows and Automations, select Task Definitions.
-
-
Click Salary Change.
-
In the Actions section, click Add Action.
-
Name -
Salary Change Metrics -
Type -
Execute Code -
Execution Sequence - Leave the default value.
-
On Event -
Complete -
Outcome - Leave blank.
-
Success Message - Leave blank.
-
Location -
Local Database -
Language -
PL/SQL -
Code - Enter the sample insert statement.
insert into eba_demo_appr_metrics(task_def_static_id,outcome_code,approver,days_elapsed,approval_date) select task_def_static_id, outcome_code, actual_owner, sysdate - cast(created_on as date), sysdate from apex_tasks where task_id = :APEX$TASK_ID;
-
-
The Error Handling, Server Side Condition, and Advanced sections can be left as-is.
-
Click Create.
-
Click Apply Changes.
The new action adds a row into EBA_DEMO_APPR_METRICS every time a Salary Change task is completed. You could set up an interactive report based on this table to allow users to view metrics on approval tasks.