A marquee feature of Flows for APEX 26.1 are adhoc sub processes*. It allows you to combine deterministic with non-deterministic process steps. Let us take a look at the following diagram that could be used by an IT support help desk to better understand this feature.
This process has deterministic steps and events like creating a ticket, search the knowledgebase and notify the customer. However, to come up with a solution an engineer might request logs, run a remote session, consult a LLM or might escalate to a level 2 support engineer. The order in which they occur is not known up front and some of these activities might even occur multiple times. To handle such situations, an ad-hoc sub process is what you will need (the box in the middle containing all activities).
For choosing the next activity, there are several modes in which an ad-hoc sub process can be modeled:
- manually - with or without a recommendation from a large language model
- hybrid - AI decides the next activity but a user task is modeled that require user intervention
- completely AI driven - with guard rails set
The adhoc sub process comes to an end when certain criteria are met. For AI driven decisions, you can set guard rails on multiple levels to keep control like specifying how many cycles are allowed.
I recommend starting manually and then switch over to AI-driven when certain activities can be run autonomously.
When configuring an ad-hoc sub process, you get a lot of options, but only a few need a value to get started:
In this business case, the process is completed when the process variable ISSUE_RESOLVED has the value 'Y'. When starting a process instance, this process variable is created and set to 'N'.
If you are not familiar with the concept of process variables, have a look here:
flowsforapex.org/latest/process-variable
To test drive this process, go to Flow Monitor and start a process instance. You can click yourself through the process including activities of the ad-hoc sub process.
Once the process is set up you can start creating the APEX app for the end user that integrates it.
My application basically consists of 5 pages. Let us get in more detail in each of these.
Interactive Report showing all support requests (page 1)
The underlying SQL joins my systems of record (supp_tickets) with running instances to get details of instances we need when navigating to the status or actions page. For demo purposes, we use the primary key of the table as our business reference here, but in real life you would use a separate business key (for example, SUPPORT-2026-12423).
select tckt.tckt_id
, tckt.tckt_id business_ref
, tckt.tckt_title
, tckt.tckt_desc
, tckt.tckt_created_on
, inst.prcs_id
, sbfl.sbfl_id
from supp_tickets tckt
join flow_instances_vw inst on tckt.tckt_id = to_number(inst.prcs_business_ref default -1 on conversion error)
join flow_subflows_vw sbfl on inst.prcs_id = sbfl.sbfl_prcs_id
where inst.dgrm_name = 'IT-Support'
and sbfl.sbfl_sbfl_id is null
;
Modal Dialog for showing the status of the process instance (page 2)
The Flows for APEX Viewer plugin was copied over from the Flows for APEX app uses flow_viewer_vw with the where clause PRCS_ID = :P2_PROCESS_ID to show the correct process diagram. The attributes of the plugin could easily be set as the view already delivers all required information.
Modal Dialog with details of a support ticket including an activity launcher (page 3)
This is a standard form page for the table SUPP_TICKETS enhanced by two process plugins of type "Manage Process Instance" to create or delete an process instance. Also, a card region based on FLOW_STARTABLE_ADHOC_ACTIVITIES_VW was added to show startable activities.
Parameter page for an activity (page 9)
After clicking on an activity, there might be some parameters that need to be filled out before starting it. We use the JSON region plugin from Uwe Simon here to show different fields for each activity and not predefined APEX items. You can copy his plugin over from the Flows for APEX app or get his latest plugin here:
github.com/simonuwe/oracle-apex-json-region.
Modal Dialog for showing activity history of the process instance (page 4)
A classic report is used based on a view that already ships with Flows for APEX:
select complete_time
, starting_object_name
, results || case when repeat_count = 1 then '' else ' ('||repeat_count||')' end result
from flow_adhoc_activity_results_vw
where prcs_id = :PROCESS_ID
and subproc_sbfl_id = :SUBFLOW_ID
and subproc_step_key = :STEP_KEY
and status = 'completed'
order by complete_time desc
The APEX application items PROCESS_ID, SUBFLOW_ID and STEP_KEY are set when calling the modal dialog to ensure that we display the past activities of the current adhoc sub process.
Summary
Adhoc sub processes enables you to combine deterministic with non-deterministic behavior in your business processes. Understanding the concept and setting up your first use case only takes a few hours. There is a lot more you can configure, so do check out the
documentation if you are ready for more.
For those of you that want to learn from my app, here it is:
download
*) Adhoc sub processes are part of Flows for APEX 26.1 Enterprise Edition and require licensing. See
flowquest.net for more information about getting the Enterprise Edition.
Comments
Post a Comment