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

2

 

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

 

 

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.

 

 

You can use the OWS install database account to connect.

 

 

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.

 

 

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.

 

 

You can use a FYI notification to send the message.

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

 

 

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:

 

 

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

 

 

On the message tab:

 

 

On the body tab:

 

 

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

 

 

Also add three other attributes.

Internal name : NAME, WISH and ADDRESSEE
Type : TEXT

Create a message attribute also called MESSAGE_TEXT.

 

 

With the following properties:

 

 

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.

 

 

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.

 

 

Save your process to the database. Select file/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.

 

 

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.

 

 

Share.

About Author

2 Comments

  1. André Verbeek on

    Hi Shafiul

    This blog is based on a Oracle Workflow standalone installation. I’m not an experienced Oracle Apps/Workflow developer. Most of the things you can do with Oracle Workflow standalone edition are possible/common in the Apps edition of Oracle Workflow (as far as i know). You can find a lot of information about the Oracle Workflow/Apps integration in the Oracle Workflow Developers Guide. This guide is shipped with the Oracle 10g Database documentation.

    Maybe the following links are also interesting:
    http://apps2fusion.com/
    http://www.workflowfaq.com/

  2. Thanks for your nice effort. Can you pleasae provide some tutorial about the deployment of workflow in Oracle apps environment????