Flows for APEX v5.0
During the ODTUG Learn From Home Series in May 2020, I announced the general availability of the open source tool Flows for APEX. Flows for APEX lets you model and run process flows in low-code style. It comes as a packaged app, so you just have to import the app and you are good to go. Also, it follows the BPMN 2.0 standard, so you could easily reuse the created flows with BPMN products like Camunda if needed.
Since I received many questions about it, I would like to give developers some insight in how to work with it. The most important thing to know is that it was designed to let APEX developers drive the flow by custom PL/SQL, not the other way around. You, as a programmer, decide when a certain step in a flow is achieved by calling the appropriate API. Let us go through a simple example. Let's say, somebody needs to be over 18 years old to get an insurance policy after submitting a form. With Flows for APEX, you would first model this flow (normally you would let the business department do this for you). The outcome may look like this:
Upon saving the flow, the XML that came out of the JS library called bpmn.io is stored as a CLOB in the table flow_diagrams. All parts of the flow are stored in table flow_objects and all connections, guess what, in flow_connections. You, as an APEX developer, can now start creating your app, thereby creating a form based on your own table, lets say forms. To display the flow in your app, reuse the plugin "BPMN viewer" from the Flows for APEX app. Lastly, you need to start the flow and instruct when it has to move one step further. You do this by calling the PL/SQL API of Flows for APEX, ideally from within your own business package. For example, after approving the submitted application form, you would call a procedure in this package called form_approve that calls the appropriate API of Flows for APEX. Of course, since we are in PL/SQL context, you could do here whatever you want: logging, calling a web service, send an e-mail, etc. Each step in the flow can have its own procedure, but this mainly depends on what you are trying to accomplish.
A basic example of a package procedure that is called from APEX could look like this:
I recommend starting off by installing the demo packaged app Order Shipment that comes with Flows for APEX v5.
Since I received many questions about it, I would like to give developers some insight in how to work with it. The most important thing to know is that it was designed to let APEX developers drive the flow by custom PL/SQL, not the other way around. You, as a programmer, decide when a certain step in a flow is achieved by calling the appropriate API. Let us go through a simple example. Let's say, somebody needs to be over 18 years old to get an insurance policy after submitting a form. With Flows for APEX, you would first model this flow (normally you would let the business department do this for you). The outcome may look like this:
Upon saving the flow, the XML that came out of the JS library called bpmn.io is stored as a CLOB in the table flow_diagrams. All parts of the flow are stored in table flow_objects and all connections, guess what, in flow_connections. You, as an APEX developer, can now start creating your app, thereby creating a form based on your own table, lets say forms. To display the flow in your app, reuse the plugin "BPMN viewer" from the Flows for APEX app. Lastly, you need to start the flow and instruct when it has to move one step further. You do this by calling the PL/SQL API of Flows for APEX, ideally from within your own business package. For example, after approving the submitted application form, you would call a procedure in this package called form_approve that calls the appropriate API of Flows for APEX. Of course, since we are in PL/SQL context, you could do here whatever you want: logging, calling a web service, send an e-mail, etc. Each step in the flow can have its own procedure, but this mainly depends on what you are trying to accomplish.
A basic example of a package procedure that is called from APEX could look like this:
procedure form_approve
( pi_process_id in number
, pi_subflow_id in number
)
is
begin
-- set process variable for gateway
-- pi_var_name => the ID of the gateway as specified during modelling
-- pi_vc2_value => the ID of the connection where the gateway should route to
flow_process_vars.set_var
( pi_prcs_id => pi_process_id
, pi_var_name => 'Gateway_over18'
, pi_vc2_value => 'Connection_yes'
);
-- move one step further
-- the engine will automatically route to the next task
flow_api_pkg.flow_complete_step
( p_process_id => pi_process_id
, p_subflow_id => pi_subflow_id
);
end;
I recommend starting off by installing the demo packaged app Order Shipment that comes with Flows for APEX v5.
To learn more about BPMN 2.0, see our example process flows at https://bit.ly/flowsforapex.
Looking forward to hear about your experiences!
Resources for APEX developers:
Download Flows for APEX: https://apex.mt-ag.com/flowsforapex
Play with it on apex.oracle.com: https://bit.ly/flowsforapex
Looking forward to hear about your experiences!
Resources for APEX developers:
Download Flows for APEX: https://apex.mt-ag.com/flowsforapex
Play with it on apex.oracle.com: https://bit.ly/flowsforapex
See a custom demo app on apex.oracle.com: https://bit.ly/flowsforapexdemo
Presentation slides: https://knowledgebase.mt-ag.com/q/flowsforapex
Presentation slides: https://knowledgebase.mt-ag.com/q/flowsforapex
Great implementation very functional ... thanks
ReplyDeleteHello Niels!
ReplyDeleteAwesome application! Many years i implement Workflows in two tables. Hard to read. Hard to maintain. Your BMPN Solution is simply genius.
Can you Package Version 4? It is much easier to downgrade a packaged App for Apex 18.1.
Thx a lot.
Great tool...
ReplyDeleteThanks for the effort to intro a low code workflow tool for us..
Thanks for sharing this great information on Oracle APEX. Actually I was looking for the same information on internet for Oracle Apex Interview Questions and Answers and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject, you can learn more about Oracle PPM Cloud by attending Oracle APEX Training.
ReplyDeleteHi great implementation. Thanks. Question -- under v5.0 there is support for usertask that calls up an APEX page. How does that pop up? When tested the flow, the diagram reach there and stops but the configured APEX page does not pop up. I saw your videos/demo that completes the flow step from external page action. However, What will be the implementation scenario when the usertask configuration has APEX page configured, how does it work from that usertask configuration.
ReplyDeleteThanks for your feedback. Great question and we will demonstrate how this works during the APEX Office Hours in December. To answer your question: you would normally have your own application that drives the process flow by using the API, as the Flow Control page in Flows for APEX is only for monitoring flow instances.
DeleteAfter specifying a page for an user task in the modeler, you can read out the complete page URL by querying flow_task_inbox_vw.link_text. You would use this in a branch of type "function returning an URL" to get to the page you specified in the modeler.
I see. Very good. Thanks
DeleteHi Niels, would like to test flows so much, but I can't install it.
ReplyDeleteDid anybody has an idea why?
Thanks and regards
Sebastian
Error Msg:
[Tue Apr 06 07:48:09.252731 2021] [auth_gssapi:error] [pid 5828] [client 10.129.130.219:60175] NO AUTH DATA Client did not send any authentication headers, referer: https://apex-test.int.xxx.com/ords/f?p=4000:73:13370802304618:::RP::
[Tue Apr 06 07:48:22.744801 2021] [auth_gssapi:error] [pid 25144] [client 10.129.130.219:60174] NO AUTH DATA Client did not send any authentication headers, referer: https://apex-test.int.xxx.com/ords/f?p=4000:73:13370802304618:::::&success_msg=RmlsZShzKSBkZWxldGVkLg%7E%7E%2FfaePvZ99rXmEf9FYp3KCGso2_zCC48ZxMXAoVUvUzNa78alhM_rJ-xjbD_nzbA-5RMGOWhCwQLJogUxWt7yTLg
[Tue Apr 06 07:49:22.518277 2021] [auth_gssapi:error] [pid 24582] [client 10.129.130.219:60191] NO AUTH DATA Client did not send any authentication headers, referer: https://apex-test.int.xxx.com/ords/f?p=4000:49:13370802304618:::49:P49_FILE_ID:47053926948996278
[Tue Apr 06 07:50:11.680909 2021] [auth_gssapi:error] [pid 24582] [client 10.129.130.219:60191] NO AUTH DATA Client did not send any authentication headers, referer: https://apex-test.int.xxx.com/ords/f?p=4000:49:13370802304618:::49:P49_FILE_ID:47053926948996278
[Tue Apr 06 07:50:15.702014 2021] [auth_gssapi:error] [pid 24582] [client 10.129.130.219:60191] NO AUTH DATA Client did not send any authentication headers, referer: https://apex-test.int.xxx.com/ords/f?p=4000:2117:13370802304618:::::
[Tue Apr 06 07:51:15.825957 2021] [proxy_ajp:error] [pid 24582] (70007)The timeout specified has expired: AH01030: ajp_ilink_receive() can't receive header
[Tue Apr 06 07:51:15.826057 2021] [proxy_ajp:error] [pid 24582] [client 10.129.130.219:60191] AH00992: ajp_read_header: ajp_ilink_receive failed, referer: https://apex-test.int.xxx.com/ords/f?p=4000:2117:13370802304618:::::
[Tue Apr 06 07:51:15.826080 2021] [proxy_ajp:error] [pid 24582] (70007)The timeout specified has expired: [client 10.129.130.219:60191] AH00893: dialog to [::1]:8009 (localhost) failed, referer: https://apex-test.int.xxx.com/ords/f?p=4000:2117:13370802304618:::::
This error seems to be specific to your environment. Could you please reproduce this on apex.oracle.com and create an issue for it on github? Thx. https://github.com/mt-ag/apex-flowsforapex/issues
DeleteHi Niels, you are right it's a config problem of our system. Hopefully our DBAs will found it.
DeleteThanks and regards Sebastian