20.3.3 Creating a Workflow Activity

Create a workflow activity by right-clicking the workflow version and selecting Create Activity.

A workflow activity specifies what kind of work APEX performs when the workflow arrives at that activity.
You can only create a workflow activity if the workflow is in development. You cannot create a workflow activity if the workflow is active.

To create a workflow activity:

  1. Choose one of the following options:
    • Right-click on the workflow version and choose Create Activity.
    • Drag and drop a specific activity from the Activity Palette into the Diagram Builder.

      Tip:

      You can drop an activity on an existing activity to automatically place the new activity next in the workflow execution order. You can also drop an activity on a connection to place the new activity between the original source and the target of the connection.
    • Right-click an existing activity in the workflow tree and select Create Activity Below.

      Tip:

      The new activity is not connected to any existing activities. You must explicitly create connections to other activities.
    • Right-click an existing activity in the workflow tree and select Create Activity After.

      Tip:

      The new activity is connected to the existing activity. If the existing activity was connected to another activity, the new activity replaces that connection.
    By default, the new activity type is Execute Code.
  2. Enter the activity Name.
    The name displays in the workflow tree and in the Diagram Builder. The activity name must be unique for the workflow.
  3. Select the activity Type:
  4. Fill in the remaining settings for the activity type.
  5. (Optional) Under Additional Data, specify a SQL Query to read additional data. For more information, see item-level help.
  6. (Optional) Under Deadline, configure Due On Type.
  7. Under Layout, set the sequence.
    The sequence determines where the activity displays in the workflow tree. The sequence does not impact the order of activities in the workflow execution chain.
  8. Continue configuring the activity:
    • Duplicate the activity by clicking on the context menu and selecting Duplicate.
    • Configure Workflow Connections by clicking the context menu and selecting Create Connection. For more on workflow connections, see Adding a Workflow Connection.
    • Create an Activity Variable by clicking the context menu and selecting Create Activity Variable. For more on activity variables, see Defining an Activity Variable.
    • Create another activity connected to this activity by clicking the Connect tool on any side of the existing activity and selecting the type for the new activity.
  9. Click Show Messages to view and fix errors.
    The Show Messages icon indicates whether there are any workflow modeling or workflow configuration errors. When you click the icon, APEX displays the list of errors. You can click on an individual error to focus on that activity in the workflow. Note that you cannot save the workflow until you address any errors.
  10. Click Save to save your changes.

20.3.3.1 Adding a Workflow Start Activity

A Start activity begins a workflow.

There can only be one start activity in a workflow.

To create a workflow start activity:

  1. Right-click on the workflow version and select Create Activity.
    You can also drag the Workflow Start activity from the Activities Palette into the Diagram Builder.
  2. Enter the activity Name.
    The name displays in the workflow tree and in the workflow diagram builder. The activity name must be unique for the workflow.
  3. Set the Type to Workflow Start.
  4. (Optional) Under Additional Data, specify a SQL Query to read additional data. For more information, see item-level help.
  5. (Optional) Under Deadline, configure Due On Type.
  6. Under Layout, set the sequence.
    The sequence determines where the activity displays in the workflow tree. The sequence does not impact the order of the activities in the workflow execution chain.
  7. Continue configuring the activity:
    • Configure Workflow Connections by clicking the context menu and selecting Create Connection. For more on workflow connections, see Adding a Workflow Connection.
    • Create an Activity Variable by clicking the context menu and selecting Create Activity Variable. For more on activity variables, see Defining an Activity Variable.
    • Create another activity connected to this activity by clicking Connect on any side of the existing activity and selecting the type for the new activity.
  8. Click Show Messages to view and fix errors.
    The Show Messages icon indicates whether there are any workflow modeling or workflow configuration errors. When you click the icon, APEX displays the list of errors. You can click on an individual error to focus on that activity in the workflow. Note that you cannot save the workflow until you address any errors.
  9. Click Save to save your changes.
A workflow can only have one Start Activity. The Start Activity cannot have any incoming connections.

20.3.3.2 Adding a Workflow End Activity

An end activity ends a workflow or a workflow branch.

To create a workflow end activity:
  1. Right-click on the workflow version and select Create Activity.
    You can also drag the Workflow End activity from the Activities Palette into the Diagram Builder.
  2. Enter the activity Name.
    The name displays in the workflow tree and in the workflow diagram builder. The activity name must be unique for the workflow.
  3. Set the type to Workflow End.
  4. Select the End State:
    • Completed - When the workflow reaches this activity, the workflow ends with the Completed state.
    • Terminated - When the workflow reaches this activity, the workflow ends with the Terminated state. This state indicates that something unexpected happened in the workflow.
  5. (Optional) Under Additional Data, specify a SQL Query to read additional data. For more information, see item-level help.
  6. (Optional) Under Deadline, configure Due On Type.
  7. Under Layout, set the sequence.
    The sequence determines where the activity displays in the workflow tree. The sequence does not impact the order of the activities in the workflow execution chain.
  8. Continue configuring the activity:
    • Duplicate the activity by clicking on the context menu and selecting Duplicate.
    • Configure Workflow Connections by clicking the context menu and selecting Create Connection. For more on workflow connections, see Adding a Workflow Connection.
    • Create an Activity Variable by clicking the context menu and selecting Create Activity Variable. For more on activity variables, see Defining an Activity Variable.
  9. Click Show Messages to view and fix errors.
    The Show Messages icon indicates whether there are any workflow modeling or workflow configuration errors. When you click the icon, APEX displays the list of errors. You can click on an individual error to focus on that activity in the workflow. Note that you cannot save the workflow until you address any errors.
  10. Click Save to save your changes.
A workflow can have one end activity or multiple end activities. An end activity does not have any outgoing connections.

20.3.3.3 Adding a Workflow Switch Activity

A switch activity defines conditional branches in your workflow.

To create a workflow switch activity:

  1. Right-click on the workflow version and select Create Activity.
    You can also drag the Switch activity from the Activities Palette into the Diagram Builder.
  2. Enter the activity Name.
    The name displays in the workflow tree and in the workflow diagram builder. The activity name must be unique for the workflow.
  3. Set the Type to Switch.
  4. Select the switch type:
  5. Fill in the remaining settings for the activity type.
  6. (Optional) Under Additional Data, specify a SQL Query to read additional data. For more information, see item-level help.
  7. (Optional) Under Deadline, configure Due On Type.
  8. Under Layout, set the sequence.
    The sequence determines where the activity displays in the workflow tree. The sequence does not impact the order of the activities in the workflow execution chain.
  9. Continue configuring the activity:
    • Duplicate the activity by clicking on the context menu and selecting Duplicate.
    • Configure Workflow Connections by clicking the context menu and selecting Create Connection. For more on workflow connections, see Adding a Workflow Connection.
    • Create an Activity Variable by clicking the context menu and selecting Create Activity Variable. For more on activity variables, see Defining an Activity Variable.
    • Create another activity connected to this activity by clicking Connect on any side of the existing activity and selecting the type for the new activity.
  10. Click Show Messages to view and fix errors.
    The Show Messages icon indicates whether there are any workflow modeling or workflow configuration errors. When you click the icon, APEX displays the list of errors. You can click on an individual error to focus on that activity in the workflow. Note that you cannot save the workflow until you address any errors.
  11. Click Save to save your changes.

20.3.3.3.1 Configuring a True False Switch

A True False switch is based on the result of a single condition that returns a boolean.

To configure a True False Switch:

  1. Set the switch type to True False Check.
  2. Set the Condition Type:
    • Rows Returned - Defined by a SQL Query.
    • Rows Not Returned - Defined by a SQL Query.
    • Expression - Defined by an PL/SQL Expression.
    • Function Body - Defined by a PL/SQL Function Body.
    • Workflow Variable = Value - Select the workflow parameters, version variables, or activity variables.
    • Workflow Variable != Value - Select the workflow parameters, version variables, or activity variables.
    • Workflow Variable is NULL.
    • Workflow Variable is NOT NULL.
  3. (Optional) Under Additional Data, specify a SQL Query to read additional data. For more information, see item-level help.
  4. (Optional) Under Deadline, configure Due On Type.
  5. Under Layout, set the sequence.
    The sequence determines where the activity displays in the workflow tree. The sequence does not impact the order of the activities in the workflow execution chain.

Add the switch branches. To create a new branch:

  1. Right-click on the Switch activity in the tree and select Create Connection.
    You can also click the context menu at the bottom right corner of the Switch activity in the Diagram Builder and select Create Connection.
  2. In the properties of the Connection, specify the following attributes:
    1. When - Specify whether this connection is for a True, False, or Null value of the condition.
    2. To - Select the target activity that the condition leads to.
  3. Click Show Messages to view and fix errors.
    The Show Messages icon indicates whether there are any workflow modeling or workflow configuration errors. When you click the icon, APEX displays the list of errors. You can click on an individual error to focus on that activity in the workflow. Note that you cannot save the workflow until you address any errors.
  4. Click Save to save your changes.

20.3.3.3.2 Configuring a Check Workflow Variable Switch

A Check Workflow Variable switch is based on the value of a workflow variable.

To configure a Check Workflow Variable Switch:

  1. Set the switch type to Check Workflow Variable.
  2. For Compare Variable, select the workflow parameter, version variable, or activity variable for the comparison.
  3. (Optional) Under Additional Data, specify a SQL Query to read additional data. For more information, see item-level help.
  4. (Optional) Under Deadline, configure Due On Type.
  5. Under Layout, set the sequence.
    The sequence determines where the activity displays in the workflow tree. The sequence does not impact the order of the activities in the workflow execution chain.

Add the switch branches. To create a new branch:

  1. Right-click on the Switch activity in the tree and select Create Connection.
    You can also click on the menu at the bottom right corner of the Switch activity in the Diagram Builder and select Create Connection.
  2. In the properties of the Connection, specify the following attributes:
    1. Operator - From the dropdown, select the appropriate operator.
    2. To - Select the target activity that the condition leads to.
  3. Click Show Messages to view and fix errors.
    The Show Messages icon indicates whether there are any workflow modeling or workflow configuration errors. When you click the icon, APEX displays the list of errors. You can click on an individual error to focus on that activity in the workflow. Note that you cannot save the workflow until you address any errors.
  4. Click Save to save your changes.

20.3.3.3.3 Configuring a Case Switch

A Case switch is based on the result of a computation.

To configure a Case Switch:

  1. Set the switch type to Case.
  2. Specify the Compare Data Type by selecting the appropriate data type for the result of the case statement or expression.
    Case supports the following data types: VARCHAR2, NUMBER, BOOLEAN, TIMESTAMP, TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONE.
  3. Specify the Compare Type by selecting either SQL Query, Expression, or Function Body.
  4. In the Code Editor, enter the Compare Query.
  5. (Optional) Under Additional Data, specify a SQL Query to read additional data. For more information, see item-level help.
  6. (Optional) Under Deadline, configure Due On Type.
  7. Under Layout, set the sequence.
    The sequence determines where the activity displays in the workflow tree. The sequence does not impact the order of the activities in the workflow execution chain.

Add the switch branches. To create a new branch:

  1. Right-click on the switch activity in the tree and select Create Connection.
    You can also click on the menu at the bottom right corner of the Switch activity in the Diagram Builder and select Create Connection.
  2. In the connection properties, specify the following attributes:
    1. Sequence - Specify the sequence. The sequence determines the order that APEX evaluates case branches at runtime.
    2. Operator - Select the branch condition expression.
    3. Value - Specify the value to compare with.
    4. To - Select the target activity the branch leads to.
  3. Click Show Messages to view and fix errors.
    The Show Messages icon indicates whether there are any workflow modeling or workflow configuration errors. When you click the icon, APEX displays the list of errors. You can click on an individual error to focus on that activity in the workflow. Note that you cannot save the workflow until you address any errors.
  4. Click Save to save your changes.

20.3.3.3.4 Configuring an If Elsif Else Switch

An If Elsif Else switch is based on AND/OR comparisons between the conditions.

To configure an If Elsif Else switch:

  1. Set the switch type to If Elsif Else.
  2. (Optional) Under Deadline, configure Due On Type.
  3. Under Layout, set the sequence.
    The sequence determines where the activity displays in the workflow tree. The sequence does not impact the order of the activities in the workflow execution chain.

Add the switch branches. To create a new branch:

  1. Right-click on the switch activity in the tree and select Create Connection.
    You can also click on the menu at the bottom right corner of the Switch activity in the Diagram Builder and select Create Connection.
  2. In the properties of the connection, specify the following attributes:
    1. Sequence - Specify the sequence. This determines the order that APEX evaluates the branches in at runtime.
    2. Type - From the dropdown, select the appropriate condition that must be satisfied for this branch.
    3. To - Select the target activity the branch leads to.
  3. Click Show Messages to view and fix errors.
    The Show Messages icon indicates whether there are any workflow modeling or workflow configuration errors. When you click the icon, APEX displays the list of errors. You can click on an individual error to focus on that activity in the workflow. Note that you cannot save the workflow until you address any errors.
  4. Click Save to save your changes.

20.3.3.4 Adding a Workflow Wait Activity

A Wait activity pauses workflow execution.

A Wait activity pauses workflow execution. The wait state updates in two ways: a Time Out after the specified duration elapses, or a call from apex_workflow.continue_activity.

To create a workflow wait activity:

  1. Right-click on the workflow version and select Create Activity.
    You can also drag the workflow Wait activity from the Activities Palette into the Diagram Builder.
  2. Enter the activity Name.
    The name displays in the workflow tree and in the workflow diagram builder. The activity name must be unique for the workflow.
  3. Set the type to Wait.
  4. For Timeout Type, specify Static, SQL Query, Expression, or Function Body.
    For Static, use ISO Duration format values.
  5. (Optional) Under Additional Data, specify a SQL Query to read additional data. For more information, see item-level help.
  6. Under Layout, set the sequence.
    The sequence determines where the activity displays in the workflow tree. The sequence does not impact the order of the activities in the workflow execution chain.
  7. Continue configuring the activity:
    • Duplicate the activity by clicking on the context menu and selecting Duplicate.
    • Configure Workflow Connections by clicking the context menu and selecting Create Connection. For more on workflow connections, see Adding a Workflow Connection.
    • Create an Activity Variable by clicking the context menu and selecting Create Activity Variable. For more on activity variables, see Defining an Activity Variable.
    • Create another activity connected to this activity by clicking Connect on any side of the existing activity and selecting the type for the new activity.
  8. Click Show Messages to view and fix errors.
    The Show Messages icon indicates whether there are any workflow modeling or workflow configuration errors. When you click the icon, APEX displays the list of errors. You can click on an individual error to focus on that activity in the workflow. Note that you cannot save the workflow until you address any errors.
  9. Click Save to save your changes.

20.3.3.5 Adding a Workflow Human Task Activity

A Human Task - Create activity creates a human task using an existing task definition.

In order to use a task as part of a workflow, you must already have the task definition configured in the application. For more information on setting up task definitions, see About Task Definitions.

To create a workflow human task activity:

  1. Right-click on the workflow version and select Create Activity.
    You can also drag the Human Task - Create activity from the Activities Palette into the Diagram Builder.
  2. Enter the activity Name.
    The name displays in the workflow tree and in the workflow diagram builder. The activity name must be unique for the workflow.
  3. Set the Type to Human Task - Create.
  4. Under Settings, set the Human Task properties:
    1. Definition - Select the Task Definition from the dropdown.
    2. Subject - Set the subject if you want to override the subject from the task definition.
    3. Priority - Set the priority if you want to override the priority from the task definition.
    4. Initiator Item - The ID of the user initiating the task. When not specified, this value defaults to the current logged-in user.
    5. Task ID Item - The page item where the ID of the newly created task instance can be stored.
    6. Details Primary Key Item - The workflow item (variable or parameter) pointing to the Primary Key for the system of records that the task definition uses.
    7. (Optional) Outcome - A workflow variable to store the task outcome.
    8. (Optional) Owner - A workflow variable to store the person who approved, rejected, or completed the task.

    Tip:

    When you create a Human Task activity, APEX creates two workflow variables: TASK_OUTCOME and APPROVER. In the activity settings, you can set the Outcome and Approver attributes to these variables. At runtime, after the task completes, the workflow variable TASK_OUTCOME is set to APPROVED or REJECTED based on the outcome of the task. Subsequent activities in the workflow can use these workflow variables. You can choose to ignore the outcome and approver details from the activity, delete the auto-generated workflow variables, and leave the corresponding task attributes empty.

    For example, a Switch activity that follows a Human Task activity can use the Check Workflow Variable type to look at TASK_OUTCOME, and branch the workflow based on TASK_OUTCOME = APPROVED and TASK_OUTCOME = REJECTED.

    Note that if there are subsequent Human Task activities in the workflow, these workflow variables are not automatically created again. You can choose to re-use the same workflow variables to store the task outcome and actual owner, or you can manually create new workflow variables if you want each Human Task activity outcome stored in a different workflow variable.

  5. (Optional) Under Additional Data, specify a SQL Query to read additional data. For more information, see item-level help.
  6. (Optional) Under Deadline, configure Due On Type.
  7. Under Layout, set the sequence.
    The sequence determines where the activity displays in the workflow tree. The sequence does not impact the order of the activities in the workflow execution chain.
  8. Continue configuring the activity:
    • Duplicate the activity by clicking on the context menu and selecting Duplicate.
    • Configure Workflow Connections by clicking the context menu and selecting Create Connection. For more on workflow connections, see Adding a Workflow Connection.
    • Create an Activity Variable by clicking the context menu and selecting Create Activity Variable. For more on activity variables, see Defining an Activity Variable.
    • Create another activity connected to this activity by clicking Connect on any side of the existing activity and selecting the type for the new activity.
  9. Click Show Messages to view and fix errors.
    The Show Messages icon indicates whether there are any workflow modeling or workflow configuration errors. When you click the icon, APEX displays the list of errors. You can click on an individual error to focus on that activity in the workflow. Note that you cannot save the workflow until you address any errors.
  10. Click Save to save your changes.

20.3.3.6 Adding a Custom Process Type Plugin as an Activity

A custom process type plugin uses a custom plugin as an activity.

To configure the process type plugin for workflow use:

  1. Navigate to the Shared Components page:
    1. On the Workspace home page, click App Builder.
    2. Select an application.
    3. On the Application home page, click Shared Components.

      The Shared Components page appears.

  2. Under Other Components, click Plug-ins.
  3. Click the plug-in you want to edit.

    The Edit page appears.

  4. In Supported For, enable Workflow Activities.

To configure the workflow to wait on this process and only progress after the process completes:

  1. Under Standard Attributes, select Wait for Completion.
  2. In Callbacks, specify the Completion function for the process.
    When the process completes and calls back into the workflow using apex_workflow.continue_activity, the workflow engine executes the Completion function before continuing with the rest of the workflow activities. Refer to APEX_WORKFLOW in Oracle APEX API Reference to learn more about the continue_activity() API.

To add the custom process type plugin to the workflow:

  1. Right-click on the workflow version and select Create Activity.
  2. Enter the activity Name.
    The name displays in the workflow tree and in the workflow diagram builder. The activity name must be unique for the workflow.
  3. Set the Type to the name of your plugin. Available custom process plugins display under the Application Components heading.
    You can also drag the custom process type plugin activity from the Activities Palette into the Diagram Builder.
  4. (Optional) Under Additional Data, specify a SQL Query to read additional data. For more information, see item-level help.
  5. (Optional) Under Deadline, configure Due On Type.
  6. Under Layout, set the sequence.
    The sequence determines where the activity displays in the workflow tree. The sequence does not impact the order of the activities in the workflow execution chain.
  7. Continue configuring the activity:
    • Duplicate the activity by clicking on the context menu and selecting Duplicate.
    • Configure Workflow Connections by clicking the context menu and selecting Create Connection. For more on workflow connections, see Adding a Workflow Connection.
    • Create an Activity Variable by clicking the context menu and selecting Create Activity Variable. For more on activity variables, see Defining an Activity Variable.
    • Create another activity connected to this activity by clicking Connect on any side of the existing activity and selecting the type for the new activity.
  8. Click Show Messages to view and fix errors.
    The Show Messages icon indicates whether there are any workflow modeling or workflow configuration errors. When you click the icon, APEX displays the list of errors. You can click on an individual error to focus on that activity in the workflow. Note that you cannot save the workflow until you address any errors.
  9. Click Save to save your changes.

20.3.3.7 Defining an Activity Variable

Add an activity variable by right-clicking the activity in the workflow tree and selecting Create Activity Variable.

To add a workflow activity variable:

  1. Right-click on the activity in the workflow tree and select Create Activity Variable.
  2. Fill in the properties for the variable:
    1. Static ID - The unique name of the variable.
    2. Label - The user-friendly label for the variable.
    3. Data Type - Select from VARCHAR2, TIMESTAMP, TIMESTAMP WITH LOCAL TIME ZONE, TIMESTAMP WITH TIME ZONE, NUMBER, or BOOLEAN.
    4. Value Type - The type of value for the variable.
    5. Value Language - Language, if applicable.
    6. (Item only) Item - The workflow parameter, version variable, or activity variable.
    7. (Boolean only) Format Mask - If applicable, fill in the variable or parameter value used to determine the values.