19.6.3.2 Creating Task Definitions

Create a Task Definition from the Shared Components page, under the Workflows and Automations heading.

To create a task definition:

  1. Select an application.
  2. Navigate to the Task Definitions page:
    1. On the application home page, select Shared Components.
    2. Under Workflows and Automations, select Task Definitions.
  3. Click Create.
    The Create Task Definition wizard appears.
  4. Specify the task definition name and define the metadata.
    1. Name - Enter a name for the new Task Definition.
    2. Subject - Provide a subject for the task definition.
      For example, Purchase Requisition for Order &ORDER_ID., where ORDER_ID is a defined parameter of the task definition that will be substituted with the parameter value on task creation. For more on substitution strings, see Substitution Strings and Bind Variables for Tasks.
    3. Static ID - Static ID for this task definition. The static ID is used when creating the task with the APEX_APPROVAL package (APEX_APPROVAL.CREATE_TASK).
    4. Priority - Set the priority for the task. Choose a number between 1 and 5, where 1 is Urgent and 5 is Lowest. The default priority is 3 - Medium.
    5. Potential Owner - The user that can potentially approve or reject the task.
      To determine potential owners dynamically, edit Participants in the Task Definition Details.
    6. Business Admin - The user who has administrative rights on tasks created by this definition.
      To determine business administrators dynamically, edit Participants in the Task Definition Details.
  5. Click Next.
    The Task Definition details page opens.
  6. Set additional attributes.
    1. Due On Interval - The ISO-format or SQL-format duration that specifies when a task is due.
    2. Task Details Page Number - If a Task Details Page already exists for this application, enter the page number here. Otherwise, select Create Task Details Page to create a new page.
      The Task Details Page allows you to view the details of the task instance when the task is selected on the Unified Task List Report. See Editing the Task Details Page.
    3. Actions Source - Specify the source of the data evaluated during the execution of the actions on the task definition.
      These actions are based on tables or SQL queries. An Actions SQL Query can reference the bind variable :APEX$TASK_PK to access the value of the primary key in the task detail row.
  7. Create Participants to assign additional people to the Task Definition.
    1. Select Add Row.
    2. Edit the Participant Type to select Potential Owner or Business Administrator.
    3. Set the Value Type.
      SQL Query, Function Body, and Expression all allow users to be dynamically selected, and can return one or more user names.
    4. Set the Value.
  8. Set Parameters.
    1. Select Add Row and fill in the parameter fields.
    2. Static Id - Identifier used to reference this parameter.
    3. Label - A user-friendly name for the task parameter.
    4. Data Type - Choose String.
    5. Required - Indicates whether this parameter is mandatory for tasks created from this task definition.
    6. Visible - Indicates whether this parameter is visible in the details page of tasks created from this task definition.
    7. Comment (Optional) - Note describing the task parameter.
    Note: The parameters set in the Task Definition also need to be set in the page process. See Creating Tasks from Task Definitions.
  9. Select Apply Changes to save all existing changes.
  10. Add Actions to the Task Definition.
    1. Click Add Action.
      The Edit Task Definition Action page opens.
    2. Name - Enter a name for the Task Definition Action.
    3. Type - Select Send Email or Execute Code.
      For Send Email, you can use predefined email templates with substitution strings. For example, you can configure a notification email to the initiator when a task is approved or rejected. For more information, see Managing Email Templates.
    4. Execution Sequence - Specify the execution sequence. Actions are executed in numerical order, from low to high.
    5. On Event - Select the event that triggers the action to execute. Events are triggered for the following operations: Create, Complete, Update, Comment, Update Priority, Delegate, Claim, Cancel, and Release.
    6. Success Message - Enter a success message that indicates the action has been successfully processed.
    7. Location - Used when the Action Type is Execute Code. Specify whether your PL/SQL code is executed in the Local Database or on a REST Enabled SQL Service.
    8. Language - Used when the Action Type is Execute Code. Select the language used to evaluate the code.
    9. Code - Provide the PL/SQL code to be executed.
      Column values from the task definition action query are available as bind variables by column name, such as :EMPNO, :ENAME, and so on. For more on bind variables, see Substitution Strings and Bind Variables for Tasks. You can expand the Examples section to see code examples.
    10. Error Message - Enter an error message that indicates the action failed to execute. Use #SQLERRM# as a placeholder for the actual ORA error message.
    11. Stop Execution on Error - Enable when processing for the current task should stop on error. Subsequent actions will not be processed, and the task will go into the ERRORED state.
    12. Condition Type - Select a condition type from the list that must be met in order for this action to be executed.
    13. Build Option - Select a build option for this action. Build options are predefined settings that determine whether or not components in an application are enabled.
    14. Comments - Enter developer notes here. These comments only display in App Builder and are not visible in the application.
  11. Click Create to go back to the Task Definition.
  12. Add any Comments for this task definition.
  13. Click Apply Changes.
APEX creates the Task Definition.