Generating Workflow Files Part 2

One of the services that I’ve done for a while now through my company, is running design and implementation reviews – spending time with customers getting to understand what they are expecting their Workflow system to do, and then looking at their workflow functional and / or technical design document, or their code that has been written, and providing a detailed analysis of the strengths, weaknesses and opportunities for improvements.  One thing that comes up time and time again is that generally the code that has been written to support a Workflow has been written without reference to the Workflow build standards that Oracle wrote some years ago – these have been out there for some time now, but here’s a brief list of what I normally find:

  • Procedure signature does not conform to the recommended signature from Oracle;
  • Use of hard-coded values for function mode and results rather than using WF_ENGINE constants;
  • No logging, or if any is in place, it doesn’t use the Workflow supplied logging package;
  • Missing or incorrect error handling.

One thing that this has really got me thinking was about how great it would be if there was some kind of framework that made it easier to write good Workflow code.

So, I sat down and put together a utility to provide well-formatted code, which provides a framework that you can plug in your specific logic.   The most important thing that a workflow developer should be focusing on is getting the flow of the process right – here’s where the developer should be devoting their efforts

  • Determining what activities are needed in the process; 
  • Deciding what level of granularity is needed
    • Should you have an activity that does lots of processing, a sub-process, or a couple of activities in one process?
    • Should you build a series of activities that perform simple steps, or use one activity which has a series of IF conditions in it?
    • etc.
  • Putting the right activities in the right order;
  • Determining error conditions;
  • Determining revisit conditions;
  • Deciding whether business events can and should be used;
  • Deciding whether to defer the process or not.

Instead of which, developers tend to be spending time on writing the PL/SQL to support the Workflow, and not enough time focusing on getting the process(es) right.

I wrote a utility which is designed to help shift this effort from PL/SQL developer onto becoming a Workflow developer.  If you install the package attached to this post, a PL/SQL package is installed which can then be used to generate code to support your Workflow.  You should define the Workflow process, and this code will then look for a specific Item Type and pick up the PL/SQL activity which you have defined and generate code for you.  If you have left any of the activities blank, then the code will create a PL/SQL package with the name of your item type, and procedures within the package named as the internal name of the activity.  The code adds logging to the procedures, error handling, and if the activity uses lookup codes, it will also generate the results at the end of the code for you.

It can also update your Workflow for you, if you set it to.  So for each Activity where you have not defined the Activity function, the code will generate the code for you to amend to support the business logic, and then update the Workflow with the name of the package and procedure which has been generated to support the process.

The code is copyright TS Fifteen Ltd (the parent company of, but I’m prepared to make the code available free for use.  If you install the code, then it must include the module header which is supplied with the code.   If you make any changes to the code, or have any suggestions for extra functionality, please contact me or add comments below.  I will be writing a fuller user guide to add to the module, but here’s the current version.

Package Specification

Package Body

By continuing to use the site, you agree to the use of cookies. more information

In common with almost all professionally run websites, this website logs the IP address of each visitor in order to keep it running reliably. This is also essential for protecting the website and its visitors from malicious attacks, including infection with malware.

This website provides information as a service to visitors such as yourself, and to do this reliably and efficiently, it sometimes places small amounts of information on your computer or device (e.g. mobile phone). This includes small files known as cookies. The cookies stored by this website cannot be used to identify you personally.

We use cookies to understand what pages and information visitors find useful, and to detect problems such as broken links, or pages which are taking a long time to load.

We sometimes use cookies to remember a choice you make on one page, when you have moved to another page if that information can be used to make the website work better. For example:
- avoiding the need to ask for the same information several times during a session (e.g. when filling in forms), or
- remembering that you have logged in, so that you don’t have to re-enter your username and password on every page.

You can prevent the setting of cookies by adjusting the settings on your browser (see your browser Help for how to do this). Be aware that disabling cookies will affect the functionality of this and many other websites that you visit.