20.14.3.4 Editing a Task Definition

Edit Task Definition details from the Shared Components page, under the Workflows and Automations heading.

20.14.3.4.1 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 that Bo, one of the potential owners in the Job Change task definition, has become a business administrator for that definition.

To edit Task Definition Participants:

  1. Select the Sample Workflows, Approvals, and Tasks app.
  2. Navigate to the Task Definitions page:
    1. On the Application home page, click Shared Components.
    2. Under Workflows and Automations, select Task Definitions.
  3. Click Job Change.
  4. Under Participants, select the row where Participant Type is Potential Owner and Value is Bo.
  5. Click Edit.
  6. Change the Participant Type from Potential Owner to Business Administrator.
  7. Click Apply Changes.
Bo is now a business administrator on all new Job Change tasks. Job Change tasks that already exist do not change.

20.14.3.4.2 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:

  1. Select the Sample Workflows, Approvals, and Tasks app.
  2. Navigate to the Task Definitions page:
    1. On the Application home page, click Shared Components.
    2. Under Workflows and Automations, select Task Definitions.
  3. Click Job Change.
  4. Under Parameters, click Add Row.
    1. Static Id - JOB
    2. Label - Previous Job
    3. Data Type - String
    4. Required - Yes
    5. Visible - Yes
    6. Updatable - Yes
  5. Click Apply Changes.
  6. Go back to the application home page, and open 7 - Request Job Change in Page Designer.
  7. Open the Processing tab, and expand the Submit Task process.
  8. Under Parameters, select Previous Job.
  9. Under Value, set the Type to Item.
  10. Set the item to P7_JOB.
  11. Click Save.
    Now, when 7 - Request Job Change is saved, the Previous Job value will be stored.
  12. Open 2 - Task Details in Page Designer, and confirm that the Details section contains the columns PARAM_LABEL and PARAM_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.

20.14.3.4.3 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:

  1. Select the Sample Workflows, Approvals, and Tasks app.
  2. Navigate to the Task Definitions page:
    1. On the Application home page, click Shared Components.
    2. Under Workflows and Automations, select Task Definitions.
  3. Click Salary Change.
  4. In the Actions section, click Add Action.
    1. Name - Salary Change Metrics
    2. Type - Execute Code
    3. Execution Sequence - Leave the default value.
    4. On Event - Complete
    5. Outcome - Leave blank.
    6. Success Message - Leave blank.
    7. Location - Local Database
    8. Language - PL/SQL
    9. 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;
  5. The Error Handling, Server Side Condition, and Advanced sections can be left as-is.
  6. Click Create.
  7. 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.