Oracle Workflow, a brief introduction – Part 2 Building a simple workflow

 

In this blog I will show you how easy it is to build a process with Oracle Workflow. This demo consist of an automatic step (plsql function) and a FYI notification. The process will be deployed in the workflow environment described in my previous blog (Part 1).

 

Workflow Builder
To build a process you need Oracle Workflow Builder 2.6.3.5. The install file can be downloaded from the following url: www.oracle.com/technology/software/products/workflow/index.html

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow client install

 

After the default installation, create a tnsnames.ora with the appropriate database connect information in the OWF client home directory.

With Workflow Builder you are able to build workflow processes and deploy them to the Oracle Workflow Server (OWS). By default there are some demo processes deployed during the installation of the OWS. You can view these processes with Workflow Builder by clicking file/open in the menu. A file/database connection window will appear.

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow logon wfb

 

You can use the OWS install database account to connect.

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow show item types

 

If you can’t see any Item Type, maybe the language of your Workflow Builder installation doesn’t match one of the available languages of the OWS installation in the database.

Detailed information about Oracle Workflow Builder and the demo workflow processes provided with OWS can be found in the Oracle Workflow Developer Guide (download.oracle.com/docs/cd/B19306_01/workflow.102/b15853.pdf).


Build a new process

The Quick Start Wizard lets you begin designing a workflow process immediately. It first loads a file called wftemplate.wft that is an outline of all the mandatory objects you need to build a workflow process and then displays a Process window for you to diagram your process.

Select Quick Start Wizard from the File menu or click on the quick start icon in the toolbar.

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow quick start wizard

 

Fill in the form that pops up. After clicking OK the following happens:
 

A  new data store is created called "Untitled-n" in the Navigator window.

The information you entered in the Workflow Quick Start Wizard window Is used to create a new item type and process activity in the data store.

The Standard item type is loaded into the new data store so that you can include standard activities in the process you create.

The Process window opens for the new process activity you defined. The Process window displays a Start and an End activity.

 

To create a database activity, right click somewhere in the process window and select New Function.

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow function properties

 

You can use a FYI notification to send the message.

Right click again in the process window and select New Notification.

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow notification properties

 

Connect the activities in the Process window by right clicking the start activity. Hold the mouse button down. Drag the mouse to the message activity. Release the mouse button. Repeat this to connect the rest.

Don’t forget to save occasionally!!!! During the save action you will receive some error messages. Ignore them and press save again.

Your process will be look like this:

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow process so far

 

To create the message right click on message in the navigator tree.

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow new message

 

On the message tab:

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow mc message properties

 

On the body tab:

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow mc message body

 

Create an attribute (right click on attributes in the navigator tree).

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow attrubute

 

Also add three other attributes.

Internal name : NAME, WISH and ADDRESSEE
Type : TEXT

Create a message attribute also called MESSAGE_TEXT.

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow message attrubite

 

With the following properties:

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow message attribute prop

 

This will copy the value of the ITEM ATTRIBUTE to the MESSAGE ATTRIBUTE at runtime.

Link the message to the notification. Double click the notification in the Process window.

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow link message to notifcation

 

Select on the node tab of the notification as performer type Item Attribute and as value Adressee. Save your process again. No error message if everything is ok.

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow performer

 

Save your process to the database. Select file/save as.

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow save as

 

You can use the OWS install database account to connect.

Create a database package (in the OWS schema) like this:

 


  CREATE OR REPLACE PACKAGE "DEMO" AS

  PROCEDURE CREATE_MC_MESSAGE (itemtype in varchar2,
                               itemkey in varchar2,
                               actid in number,
                               funcmode in varchar2,
                               resultout out varchar2
                              );

END DEMO;
/
CREATE OR REPLACE PACKAGE BODY "DEMO" AS

  PROCEDURE CREATE_MC_MESSAGE (itemtype in varchar2,
                               itemkey in varchar2,
                               actid in number,
                               funcmode in varchar2,
                               resultout out varchar2
                              ) AS
                             
  l_name varchar2(100);
  l_wish varchar2(100);
 
  BEGIN

  —
  — execute only in run mode
  —
  if ( funcmode = ‘RUN’ ) then

    —
    — Read attribute values
    —

    l_name := wf_engine.GetItemAttrText(itemtype => itemtype,
                                        itemkey => itemkey,
                                        aname => ‘NAME’
                                       );
    l_wish := wf_engine.GetItemAttrText(itemtype => itemtype,
                                        itemkey => itemkey,
                                        aname => ‘WISH’
                                       );

    —
    — create the message text
    —
   
    wf_engine.SetItemAttrText (itemtype    => itemtype,
                               itemkey => itemkey,
                               aname => ‘MESSAGE_TEXT’,
                               avalue =>  l_wish||’ ‘ ||l_name
                              );

    resultout := ‘COMPLETE’;
 
  end if;
 
  exception
    when others then
        wf_core.context(‘DEMO’,’CREATE_MC_MESSAGE’,itemtype,itemkey,actid,funcmode);
        raise;

  END CREATE_MC_MESSAGE;

END DEMO;
/


 

You are now ready to initiate the process.

Open the workflow homepage (http://<hostname>:<port>/pls/wf/wfa_html.home) and select the Launch Processes option. Click on the Demo link in the page that appears.

Fill in the launch form and press OK.

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow launch process1

 

Go back to the first page of the workflow homepage by clicking the Home icon on the top left.

The worklist contains now an open notification. Enter the worklist and open the notification.

 

Oracle Workflow, a brief introduction - Part 2 Building a simple workflow mc message end1

 

2 Comments

  1. André Verbeek January 26, 2009
  2. Shafiul January 20, 2009