In your BPMN process, it is the Task objects that actually do the work! Starting with Flows for APEX V5.0, tasks can be modeled with specialty task objects that call APEX pages, run scripts, and send messages. This section describes those tasks and how to use and configure them.
Supported Task Types
1. bpmn:task - Task
This is the standard, generic, BPMN task. It has no special behavior when a process is executed.
Typically these are used in the early stages of modeling a business process, but as a project moves towards creating an executable process model, tasks will get converted to more specific task types.
2. bpmn:userTask - Calls an APEX Page or an APEX Approval Task
userTask objects can be used for an online task to be performed by a user. Currently, the following userTask types are enabled:
- call an APEX page
- call an APEX Approval Task
The userTask type is set in the General tab of the Process Modeler.
2a. APEX Page UserTask
APEX Page User Tasks: APEX Page userTasks are configured in the APEX Page tab of the Flows for APEX flow modeler properties panel with the information required to call an APEX page. This configuration will be familiar to anyone who has configured APEX menus.
Page Items contains a comma-separated list of items to be set in the calling page.
Item Values contains a comma-separated list of values to be supplied. The following items are available to be substituted into the Item Values string at runtime:
- Flows for APEX Process Variables (of type varchar2).
These are specified using the syntax
&F4A$<variable_name>.&F4A$ is required to be upper case. Note the trailing period ‘.’. Note also that substitution currently only works on process variables of type
varchar2, due to format translation issues on dates and numbers.
- Flows for APEX Pseudo Variables.
The current Process ID, Subflow ID, and Step Key are also available as pseudo variables.
These are specified as
Note that you will need to pass the Process_ID, Subflow_ID, and Step Key to a page as its context. The page will need these step the process forward when it is finished, using a flow_step_complete call.
2b. APEX Approval UserTask
APEX Approval Tasks: APEX Approval userTasks are configured in the APEX Approvals tab of the Flows for APEX Flow Modeler properties panel. Select the Task Definition to be used and then pass information to the task. You also specify a Flows for APEX process variable to receive the approval result. APEX Approvals are only supported on Oracle APEX v22.1 and above.
To specify a Task Definition, you must first configure one in your APEX application. These can be found in the Shared Components section of the Application Builder. You should normally add a parameter to the Task Definition to store the Flows for APEX Process ID, to act as a reference back to Flows for APEX.
- Input: This can be toggled between ‘Manual Input’, which allows you to directly enter configuration data, and ‘Use APEX meta data’, where the flow modeler will use the APEX application meta data to populate list of values providing valid choices. You can freely toggle between these two positions as you complete individual configuration items.
- Application: If you are using APEX meta data, pick the application containing the Task Definition from the pull down menu. If you are using manual input, specify the Application ID.
- Task Definition: If you are using APEX Meta data, select the Task Definition from the pull down menu. If you are using manual entry, enter the static ID of it.
- Subject: This will create the subject heading for the approval on a page of type Unified Task List. If you leave this empty, the heading specified in the Task Definition will be used. If specified in Flows for APEX, the subject can contain items that are substituted by Flows for APEX (using the &F4A$var_name. syntax), as well as Task Definition parameters (using the ¶meter. syntax).
- Business Reference: This can be used ie. to pass the primary key of the subject record from Flows for APEX to the approval task in APEX. In Flows for APEX, the subject primary key is normally kept in the BUSINESS_REF process variable to link a process instance to its systems of record. **
- Parameters: This is where you specify the input parameters to be passed into the Task Definition. This will contain the task ‘payload’, as well as the Flows for APEX Process ID. **
- Priority: By default, the Approval User Task will operate with the priority specified in the APEX Task Definition. If you want to override this, you can specify a priority here. **
- Initiator: By default, the task will be initiated by the current APEX user. If you need to override this, you can specify this. **
- ** These can all be specified using a Flows for APEX process variable, which will be substituted.
3. bpmn:scriptTask - Runs a PL/SQL script
scriptTask runs a user supplied PL/SQL function. Good practice would be to have this call an existing procedure or package, which implements your application logic.
Process variables and pseudo variables are available inside your PL/SQL procedure as follows:
- Flows for APEX Process Variables. Process variables can be retrieved and used inside your procedure, using the flow_process_vars setters and getters.
Flows for APEX Pseudo Variables. Process ID, Subflow ID, and Step Key are available inside your procedure using following function calls
flow_globals.process_id flow_globals.subflow_id flow_globals.step_key
In earlier versions of Flows for APEX, prior to v21.1, you could have done this using the syntax flow_plsql_runner_pkg.g_current_prcs_id, which is now deprecated.
For example, where we have a process variable ordr_id that is used to link our business process to its subject order, we can retrieve the order ID inside our procedure using the following code snippet:
l_process_id := flow_globals.process_id; l_order_id := flow_process_vars.get_var_vc2 ( pi_prcs_id => l_process_id, pi_var_name => 'ordr_id' );
APEX Page Item values are available to your procedure if you opt to bind them into your process in the modeler. By default, they are not available. Furthermore, using Page Items to pass values from one process step to another is not recommended, and from V22.1 is now deprecated. Instead, you should use Process Variables to pass values from one process step to another.
Note that, depending upon your process, a scriptTask might not be executed from the context of an APEX page, and so APEX Page Items might not be available. This would occur if a script is run (or re-run) later, after another user has performed part of the process, or if a task operates as a result of, for example, a timer firing. Use of Page Items to pass values between steps also makes your process steps non-restartable in the event of an error. For all these reasons, you should use Flows for APEX process variables as a variable system that is persistent for the life of your business process, rather than APEX page variables which only persist during a user session.
4. bpmn:serviceTask - for running external services
Currently serviceTask can be used for the following services:
- Sending Mail defined declaratively in your process model. 🆕
- Sending Mail using an APEX_MAIL template. 🆕
- Running a PL/SQL script to run your own serviceTask.
5. bpmn:manualTasks - for non-IT tasks
manualTasks do not currently have any special functionality and currently behave like a standard bpmn:task objects.
6. bpmn:businessRuleTask - for automated decision making🆕
Currently businessRuleTask can be used for the following services:
- Running a PL/SQL script to run your own businessRuleTask. 🆕