Oracle Workflow Tutorial

Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

3/7/2016 oracle Workflow tutorial

LEARN  SHARE  CONNECT

Search

ARTICLES / TOOLS / WORKFLOW

Workflow tutorial
Prudhvi

Apr 17, 2011

Overview:

This workflow tutorial will illustrate how to create or define a new workflow from scratch including attributes, notifications,
messages, roles or users, functions, processes and last but not the least, how to launch a workflow from PL/SQL. The workflow
concepts are better explained using an example.

Business Requirement:

When an item is created in inventory, workflow needs to be launched and it should collect the details of the item created and sends
a notification to group of users along with the details and link to master item form.

Process flow:

When an item is created it will create/insert a record in MTL_SYSTEM_ITEMS_B so create a database trigger on the table and
launch workflow from that trigger. All you need to do is create the workflow, create the trigger, pl/sql package, roles and finally
create an item in inventory.

Open WFSTD and save as new workflow

Create Process

Create Functions including START and END

Create Attributes

Create Messages

Create Notification

Create Roles & assign to notification

Link all activities with in process

Save workflow to database

Create database trigger

Create PL/SQL Package

http://www.erpschools.com/articles/workflow­tutorial 1/28
3/7/2016 oracle Workflow tutorial

Run “Workflow Background Process” Concurrent Program

1) Open WFSTD and save as new workflow:

Navigation: File >> Open

Click Browse then navigate to Workflow installation directory

Navigation: Workflow Installation Directory WFDATAUSWFSTD

Now Click File > Save as, Enter “ErpSchools Demo” and click OK

Right click on WFSTD and select New Item type

http://www.erpschools.com/articles/workflow­tutorial 2/28
3/7/2016 oracle Workflow tutorial

Enter the fields as shown in below image

Now you will see ErpSchools Demo icon in the Navigator

http://www.erpschools.com/articles/workflow­tutorial 3/28
3/7/2016 oracle Workflow tutorial

Expand the node to see attributes, processes, notifications, functions, Events, Messages and lookup types.

2) Create Process

Double click on Process to open up the properties window as shown below

http://www.erpschools.com/articles/workflow­tutorial 4/28
3/7/2016 oracle Workflow tutorial

Enter the fields as shown in below image

Click OK

http://www.erpschools.com/articles/workflow­tutorial 5/28
3/7/2016 oracle Workflow tutorial

Double click ErpSchools Process Icon to open process window where we can draw our workflow diagram.

Right click on process window and then click on New Function.

http://www.erpschools.com/articles/workflow­tutorial 6/28
3/7/2016 oracle Workflow tutorial

Properties window will open as shown below

Change/Enter the fields as shown in below image

Change Item Type to Standard. This is important as we are using START and END functions which came from WFSTD (Standard

item type).

Select Internal Name as Start

Remaining fields will be populated automatically.

Go to Node tab and select “Start” from the drop down. This is mandatory and can’t be ignored.

http://www.erpschools.com/articles/workflow­tutorial 7/28
3/7/2016 oracle Workflow tutorial

Click Apply then OK

Again Right click on white space and click New Function

http://www.erpschools.com/articles/workflow­tutorial 8/28
3/7/2016 oracle Workflow tutorial

Change the properties as below

Item Type: Standard

Internal Name: END

Go to Node tab and select “End” from the drop down. This is mandatory and can’t be ignored.

Click Apply and then OK

http://www.erpschools.com/articles/workflow­tutorial 9/28
3/7/2016 oracle Workflow tutorial

We will come back to this process window later after we have all components / activities ready to link. for now just close process
window and go to navigator

3) Create Workflow Function:

Right click on white space  in the process window and then click New Function. Alternatively you can select Functions in Navigator

and right click to get “New Function” option

Enter the fields as shown in below image

http://www.erpschools.com/articles/workflow­tutorial 10/28
3/7/2016 oracle Workflow tutorial

Click Apply and then OK

We will join these activities later after we have our notification ready.

4) Create Workflow Attributes:

Navigation: Window menu > Navigator

http://www.erpschools.com/articles/workflow­tutorial 11/28
3/7/2016 oracle Workflow tutorial

Right click on Attributes and click New Attribute

Enter the fields as shown in below image

http://www.erpschools.com/articles/workflow­tutorial 12/28
3/7/2016 oracle Workflow tutorial

Click Apply and then OK

Create one more attribute

Right click on Attributes and click New Attribute

Enter the fields as shown in below image

http://www.erpschools.com/articles/workflow­tutorial 13/28
3/7/2016 oracle Workflow tutorial

Click Apply and then OK.

Here INVIDITM form belongs to “Master Item” for from inventory module.

Now we have two attributes ready to use.

5) Create Workflow Messages:

click on Message and click New

Properties window will pop up as show below

http://www.erpschools.com/articles/workflow­tutorial 14/28
3/7/2016 oracle Workflow tutorial

Enter the fields

Internal Name: ERP_SEND_ITEM_DET_MSG

Display Name: Send Item Details Message

Description: Send Item Details Message

Go to Body Tab and enter as shown below

http://www.erpschools.com/articles/workflow­tutorial 15/28
3/7/2016 oracle Workflow tutorial

Click Apply and then OK

Navigation: Window Menu > Navigator

Select Item Form Link Attribute

Drag and drop both attributes to “Send Item Details Message”. If you miss this step you will not be able to see the attribute values

with in email.

6) Create Workflow Notifications:

Right click on white space in process window and then click New Notification

http://www.erpschools.com/articles/workflow­tutorial 16/28
3/7/2016 oracle Workflow tutorial

Enter fields as shown in the below image

Message: Sned Item Details Message

Click Apply and then OK

7) Create Roles and assign it to notification: 

Adhoc roles can be created through PL/SQL API’s from database or they can be created from Applications using User Management
Responsibility. If you use PL/SQL to create roles make sure you give all user names and role names in UPPER case to avoid some
problems

Alternatively you can use USERNAME directly with in the notification.

If you wish to create User Roles manually then follow the below articles

http://www.erpschools.com/articles/workflow­tutorial 17/28
3/7/2016 oracle Workflow tutorial

User Role Creation through API: WF_DIRECTORY API 

User Role Creation from "User Management" Responsibility: Role Creation 

Using Adhoc roles in workflow notifications:

Navigation: File > Load Roles from Database

Select roles you want to use and then click OK.

Open the notification properties and then navigate to node tab, select performer as the role you just created and loaded from
database.

8)Link all activities with in process

Open Process window and join all the activities we created so far. To join one activity to other you need to first select the source

activity , right click and drag a line to destination activity.

9)Save workflow to database

There are three different methods to upload a workflow into database. The simple one is from workflow builder tool itself.

Go to File > Save as and choose the option “database”.

Provide your apps user login credentials and click OK.

To understand how to save workflow from a file (.wft) to database and vice versa you can read the below article.

Workflow Migration

10)Launching workflow from PL/SQL:

 Make sure to run "Workflow background process" after item is created.  

http://www.erpschools.com/articles/workflow­tutorial 18/28
3/7/2016 oracle Workflow tutorial

Workflow will get into defered status initially and after workflow background process program is completed it should be 
in running mode.

Compile the PL/SQL code in database. 

First create a database trigger as below to call a PL/SQL procedure from which you kick off the workflow.

–Create Database Trigger

1 CREATE OR REPLACE TRIGGER "ERP_SCHOOLS_DEMO_TRIGGER" AFTER INSERT ON INV.MTL_SYSTEM_ITEMS_B REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW

2 DECLARE

3 lv_id                 NUMBER          := :NEW.inventory_item_id;

4 lv_item_segment1      VARCHAR2(100)   := :NEW.segment1;

5 lv_itemtype           VARCHAR2(80)    := :NEW.item_type;

6 lv_user_id            NUMBER          := -1;

7 lv_itemkey            VARCHAR2(10);

8 lv_orgid              NUMBER          :=2;

9 error_msg             VARCHAR2(2000);

10 error_code            NUMBER;

11 BEGIN

12 lv_user_id := fnd_global.user_id;

13 lv_orgid := fnd_global.org_id;

14 lv_itemkey := 1132; -- This should be unique value

15 ERP_DEMO.LAUNCH_WORKFLOW('ERP_DEMO'

16 ,lv_itemkey

17 ,'ERPSCHOOLS_PROCESS' --process name

18 ,lv_id

19 ,lv_orgid

20 ,lv_item_segment1

21 );

22 EXCEPTION WHEN OTHERS THEN

23 error_code := SQLCODE;

24 error_msg  := SQLERRM(SQLCODE);

25 RAISE_APPLICATION_ERROR(-20150,error_msg);

26 END;

–Create PL/SQL Package to kickoff workflow

1 CREATE OR REPLACE PACKAGE APPS.ERP_DEMO IS

2 PROCEDURE LAUNCH_WORKFLOW

3 (

4 itemtype        IN VARCHAR2,

5 itemkey         IN VARCHAR2,

6 process         IN VARCHAR2,

7 item_id         IN NUMBER,

8 org_id          IN NUMBER,

http://www.erpschools.com/articles/workflow­tutorial 19/28
3/7/2016 oracle Workflow tutorial

9 item_segment1   IN VARCHAR2

10 );

11 END ERP_DEMO;

1 CREATE OR REPLACE PACKAGE BODY APPS.ERP_DEMO IS

2 PROCEDURE LAUNCH_WORKFLOW(

3 itemtype         IN VARCHAR2,

4 itemkey          IN VARCHAR2,

5 process          IN VARCHAR2,

6 item_id          IN NUMBER,

7 org_id           IN NUMBER,

8 item_segment1    IN VARCHAR2

9 )

10 IS

11 v_master_form_link varchar2(5000);

12 v_item_number varchar2(100);

13 v_add_item_id varchar2(5000);

14 error_code varchar2(100);

15 error_msg varchar2(5000);

16 BEGIN

17 v_add_item_id := ' ITEM_ID="' || item_id || '"';

18 v_item_number := item_segment1;

19 v_master_form_link := v_master_form_link || v_add_item_id;

20 WF_ENGINE.Threshold := -1;

21 WF_ENGINE.CREATEPROCESS(itemtype, itemkey, process);

22 -- Get the value of attribute assigned in workflow

23 v_master_form_link := wf_engine.getitemattrtext(

24 itemtype => itemtype

25 ,itemkey  => itemkey

26 ,aname    => 'ERP_SEND_ITEM_FORM_LINK');

27 -- assign values to variables so that you can usethe attributes

28 v_master_form_link := v_master_form_link||':#RESP_KEY="INVENTORY" #APP_SHORT_NAME="INV" ORG_MODE="Y" ';

29 v_master_form_link := v_master_form_link || v_add_item_id;

30 --set the attribute values in workflow so that you can use them in notifications

31 WF_ENGINE.SetItemAttrText(itemtype, itemkey, 'MASTERFORM', v_master_form_link);

32 WF_ENGINE.SetItemAttrText(itemtype, itemkey, 'ERP_ITEM_NUMBER', item_segment1);

33 -- start the workflow process

34 WF_ENGINE.STARTPROCESS(itemtype, itemkey);

35 EXCEPTION WHEN OTHERS THEN

36 error_code := SQLCODE;

37 error_msg  := SQLERRM(SQLCODE);

38 -- add dbms or fnd_output messages as required

39 END LAUNCH_WORKFLOW;

40 -- This procedure will just put the item number into workflow attribute ERP_ITEM_NUMBER

http://www.erpschools.com/articles/workflow­tutorial 20/28
3/7/2016 oracle Workflow tutorial

41 PROCEDURE GET_ITEM_DETAILS(

42 itemtype        IN VARCHAR2,

43 itemkey         IN VARCHAR2,

44 actid           IN NUMBER,

45 funcmode        IN VARCHAR2,

46 resultout       OUT NOCOPY VARCHAR2

47 )

48 IS

49 v_GET_ITEM_NUMBER VARCHAR2(1000);

50 BEGIN

51 SELECT SEGMENT1 INTO V_GET_ITEM_NUMBER FROM MTL_SYSTEM_ITEMS_B WHERE ROWNUM =1;

52 WF_ENGINE.SetItemAttrText(itemtype, itemkey, 'ERP_ITEM_NUMBER',v_GET_ITEM_NUMBER );

53 -- you can use the get function as below.

54 --v_GET_ITEM_NUMBER := wf_engine.getitemattrtext(

55 --                                        itemtype => itemtype

56 --                                        ,itemkey  => itemkey

57 --                                        ,aname    => 'X_ATTRIBUTE');

58 resultout:='COMPLETE:'||'Y';

59 exception when others then

60 dbms_output.put_line('Entered Exception');

61 fnd_file.put_line(fnd_file.log,'Entered Exception');

62 END GET_ITEM_DETAILS;

63 END ERP_DEMO;

64 /

  
Create Inventory Item  

Go to Inventory module and create inventory item from master org form.

Run “Workflow Background Process” concurrent program 
  

Go to System administrator responsibility and launch concurrent program “Workflow background process” and choose Yes to the
parameter process deferred.

RELATED POSTS

ARTICLES /

Register PL SQL stored procedure in Oracle Apps

TOOLS /

Report Creation through wizard

http://www.erpschools.com/articles/workflow­tutorial 21/28
3/7/2016 oracle Workflow tutorial
WORKFLOW /

Oracle Business Events

ARTICLES /

AutoInvoice Grouping Rules

TOOLS /

Shell Script Tutorial

WORKFLOW /

Oracle workflow ad hoc roles

ARTICLES /

Folders in Oracle Forms

TOOLS /

Forms Personalization Tutorial

WORKFLOW /

Workflow migration: WFLOAD | Workflow Definitions Loader

ARTICLES /

Responsibility in Oracle Apps

‹ Display and change images dynamically in XML DataLoader Tutorial ›


publisher

39 COMMENTS

thirupathi 
JULY 22, 2011 @ 4:33 PM

this is vary use full material

thank u

shantanu jain 
AUGUST 2, 2011 @ 7:27 AM

this is the best website for study ………….

kartheeka 
AUGUST 10, 2011 @ 1:59 PM

good for beginners

abhi karthi 

http://www.erpschools.com/articles/workflow­tutorial 22/28
3/7/2016 oracle Workflow tutorial

AUGUST 10, 2011 @ 2:01 PM

very good material to easy learn

sudhakar 
AUGUST 10, 2011 @ 4:43 PM

Excellent for beginners

Aparna 
AUGUST 18, 2011 @ 2:03 PM

Can you please post such screenshots for discoverer tutorial for beginner like where to write the query and all

javed khan 
AUGUST 23, 2011 @ 5:06 PM

Can you please post such screenshots for discoverer plus tutorial for beginner like how to edit the query and how to create new

worksheet and how to define the LOV for the parameter like wise……All related informatin.

sreenivas 
SEPTEMBER 29, 2011 @ 11:35 AM

Its good but but you missed the connectivity between start, function, notification and end. 

Its more usefull when yo provide such sreen shots for who ever wants to do sample workflow development.

and its more usefull when you provide issues where you mostly will struck up while developing workflow.

you site is very usefull for techical consultant.Keep it up our job my friend.

Thanks 
Sreenivas

RAKESH KUMAR KAR 


OCTOBER 13, 2011 @ 3:01 PM

this is vary use full material

thank u. It help me a lot.

MILAN 
OCTOBER 14, 2011 @ 2:22 PM

plz give me me a solution— When an item is created it will create/insert a record in MTL_SYSTEM_ITEMS_B ,the notification goes

to the creator. 
Workflow will launched from concuurent program not from the database trigger.

will u plz help me out?

http://www.erpschools.com/articles/workflow­tutorial 23/28
3/7/2016 oracle Workflow tutorial

Waqas Hassan 
OCTOBER 23, 2011 @ 3:52 PM

Hi,

I want to download “Oracle Workflow Builder”. How can i download this software?

Regards.

Core Tamil 
NOVEMBER 25, 2011 @ 4:47 PM

Ammmaa Apdiya..

Mahendar 
DECEMBER 8, 2011 @ 3:32 PM

Use ful…

but need brief intruduction about the used proces,,,,,

mahesh 
DECEMBER 20, 2011 @ 3:43 PM

hi, 

how to add request date date column in order workflow first table and this column extracts information from order line request

date..

PLZ help me

sreekanth 
DECEMBER 21, 2011 @ 9:48 AM

Excellent material for the beginners. Thk you erp schools.

shishu paul 
FEBRUARY 7, 2012 @ 2:53 PM

Very good material and definitions and like as an live demonstrations. Shishu Paul Chandigarh

Raman 
MAY 3, 2012 @ 12:26 PM

Dear Sir,

Very good material, but small issue while saving the workflow, can you help me out. Please find the error given below

http://www.erpschools.com/articles/workflow­tutorial 24/28
3/7/2016 oracle Workflow tutorial

382: Design Validation generated 1 warning(s). You may save invalid definitions but they should not be used in running process.

354: ‘SAVE’ validation failed for activity ‘ERP_DEMO/ERP_ITEM_PROCESS’. 

352: Process must contain a start activity with no ‘in’ transitions.

Raman

Jack 
JUNE 8, 2012 @ 12:51 AM

Good effort, but alot of gaps.. it need more clarifications..anyway thanks !

aithya 
AUGUST 22, 2012 @ 3:46 PM

hi 
good material oracle workflow

Nageswara Rao 
AUGUST 27, 2012 @ 12:39 PM

Hi Sir

This Example is very good.please tell me out deploy oracla apps.

sasha 
OCTOBER 2, 2012 @ 11:22 PM

Thank u sir. God bless u

Sunil Mane 
FEBRUARY 22, 2013 @ 12:26 PM

I have tried this example. When I saved in data base and checked from tables, get data from

item_types,messages,attributes,processes. But i cant get value for notification from ‘WF_NOTIFICATIONS’ table. I have created

item in master organization and again checked but still not getting value for notification and also from front end on workflow
screen. Can u help me to resolve it.

Puspendu Das 
APRIL 10, 2013 @ 6:24 PM

I am also facing the same problem as Sunil Mane

abhi 
MAY 21, 2013 @ 9:47 PM

http://www.erpschools.com/articles/workflow­tutorial 25/28
3/7/2016 oracle Workflow tutorial

Great …. document

Regards 
Abhi

Subhan 
AUGUST 26, 2013 @ 3:01 PM

This is very use full material and very easy for beginner.

Jagadekara Reddy 
SEPTEMBER 25, 2013 @ 3:06 PM

HI RAMAN, 
DOUBLE CLICK ON START ICON NODE TAB GIVE START/END AS START 

AND END FOR END ICON THEN IT WILL VALIDATE

Abid 
OCTOBER 4, 2013 @ 5:39 PM

workflow can’t be initialize from database trigger. 

see note 603595.1

Abid 
OCTOBER 4, 2013 @ 6:22 PM

Sorry for previous comments 
Workflow can’t trigger from database trigger unless you run 

Workflow Background Engine concurrent request

Mahtab 
OCTOBER 12, 2013 @ 11:25 AM

Excellent study material

chandu 
JUNE 11, 2014 @ 2:20 PM

This is good for beginers.

Thanks for you effort!!!

chandu 
JUNE 11, 2014 @ 2:22 PM

Good material for beginers.

http://www.erpschools.com/articles/workflow­tutorial 26/28
3/7/2016 oracle Workflow tutorial

Thanks for your effort

Priya MP 
JUNE 26, 2014 @ 2:01 PM

This tutorial is really helpful. Is it possible to query the WS_NOTIFICATIONS table?

venkat 
JULY 2, 2014 @ 1:27 PM

Hi Sir,

Thanks for your effort

vedashruti 
OCTOBER 14, 2014 @ 3:39 AM

very simple and detailed explanation… best site for beginners

venkatesh 
JANUARY 21, 2015 @ 4:24 PM

very helpful for beginners

Anuj 
SEPTEMBER 23, 2015 @ 6:59 AM

Hi,

I followed the steps and I am getting the notifications but I am getting the following message displayed 

‘New Item is created 

Item Number #&ERP_ITEM_NUMBER’ it is not displaying the item created.

Any guidance in resolving this issue will be appreciated.

AP 
DECEMBER 11, 2015 @ 3:14 PM

Hi, 

I have completed all the way till Run “Workflow Background Process” concurrent program. Where do we see result? Please guide us
with the further steps. Appreciated.

Thanks, 
AP

AP 

http://www.erpschools.com/articles/workflow­tutorial 27/28
3/7/2016 oracle Workflow tutorial

DECEMBER 11, 2015 @ 3:16 PM

Hi, 

I have completed all the way till Run “Workflow Background Process” concurrent program. Where do we see result? Where can I
find the notification. Please guide us with the further steps. Appreciated.

Thanks, 
AP

Sagar Tarade 
FEBRUARY 16, 2016 @ 10:32 AM

Very helpful study material for Workflow learner…:)

LEAVE A REPLY

YOUR NAME

YOUR EMAIL

YOUR WEBSITE

PO ST C O MM E N T


BA C K T O T OP

[email protected] | +1 847 857 7655 (USA) (WhatsApp) | [email protected] (iMsg) | erpSchools (Skype)

Copyright erpSchools & Prudhvi Avuthu

Copying of content without written permission is not allowed.

http://www.erpschools.com/articles/workflow­tutorial 28/28

You might also like