Overview of Workflow
Why we
need workflow?
Business
process today involves getting many types of information to multiple people as
per business rules that are constantly changing.
Workflow is
just a mean to automate business process as per business rules.
Workflow Process Components
Depending
on a workflow you create, you need to define some or all of the following types
of components to make a process:
·
Item Types
·
Lookup Types
·
Messages
·
Attributes
Item Types
Suppose we
have some processes related to Purchase Order like PO approval, notify approver
etc.
We will
include these processes under the item type PO as they are helping in managing
Purchase Order.
Following
figures depicts how to create new item type:
Open
workflow builder, click on file menu then new to create new data store.
Data store
is nothing but a file that stores your WF definition. Save it with a name you
desire.
Right Click
on data store created and select new item type
Item Type
window pops-up, provide information for following:
Internal
Name: XXXWF
Display
Name: XXAATRNG Workflow
Description:
XXAATRNG Workflow
Persistence:
Temporary
Number of
days: 0
Now item
type is created. Click on expand beneath item type in navigation tree to see
components attached with item type.
Attributes
Attributes
are like a global variable which are required to store information necessary to
complete wf process.
For
example, PO Number, PO description, sends to role etc. which will be required
by an activity in a process like PO Validation.
Following
figures depict how to create attributes:
Right click
on attributes node beneath item type XXAATRNG Workflow.
Attribute
definition window pops up; provide information for the following fields:
Internal
Name: PO_ID
Display
Name: PO ID
Description:
Unique identifier
Type : text
Like this
you can create as many attributes as needed.
Look Types
It is just
a static list of values which can be referenced by activities, notifications
etc.
Messages
The
messages branch lists all the available WF messages for the current item type.
A message is what a notification activity sends to role or a user. A message
can prompt a user for an action to take that determines what the next activity
in a process should be.
First you
need to define message by right clicking on the messages branch in the
navigation tree. Provide the following information:
Internal
Name: PO_INFO
Display
Name: PO Information
Description:
Information related to PO
Priority:
normal/high/low
Click on
Body tab to define body of a message.
Suppose we
want to give the description of the PO also along with the message, then copy
the attribute with ‘&’ as a prefix. To have PO description in a message
simply drag an item attributes PO_DESCRIPTION number and drop under current
message.
Workflow process Diagram
To create a
process diagram, open a process window by double click or right click and
select new process. It prompts for the following information:
Internal
Name: PO_APPROVAL_PROCESS
Display
Name: PO Approval Process
Result type
: None
Runnable :
checked
After
providing values for the above mentioned fields, double click on the process
you have just created. A process window opens.
This is a
workspace where you will define business process.
To add
standard activities provided by Oracle workflow copy an item type standard to
your current item type.
After doing
so, you navigator tree will look as depict below :
Directory
Service and Standard types will be added automatically.
Start and end activities
Every WF
process starts with the start activity and ends with the end activity. To add
start and end activities you need to simply drag start and end function from a
standard item type like depict below:
Select
Start function under function branch in the standard item type and drag it to
your process window.
After doing
so, process window look like as shown below:
Same needs
to be done for adding end activity.
Transitions
It just
represents a flow between activities.
For
example, we have an activity in a process which selects an approver and
depending on the result it decides whether to end the process or send a
notification to approver for his approval.
We have
already added the start activity, now right on the process diagram and select
new function and provide the following in the pop up window:
Item
Type: Requisitiontest
Internal
Name: SELECTAPPROVER
Display
Name: SELECT APPROVER
Description:
Select the appropriate approver from the employee approval hierarchy
Icon:
FNDUSER.ICO
Function
Name: WF_REQDEMO.SELECTAPPROVER
Function
Type: PL/SQL
Result
Type: Boolean
After
providing values in the above mentioned fields, process window look like this :
To
represent a flow fro, the start activity to select approver, right click on
start activity and drag till select approver activity. Your process window will
look like as shown below:
Now
depending on the result of this activity, we will decide what will be the next
activity should be.
If the PO
is being validated then we can decide what will be the next step, we can set
the role whosoever is validating the PO.
If the PO
is being validated then the status of the flag will be changed to VALIDATED and
notification will be send to the user.
This is
been depict in the following figures:
Right click
on process window and select new function. It pops up a window requiring
following information:
Item
Type: XXAATRNG Workflow
Internal
Name: SET_ROLE
Display
Name: Set Role
Icon:
LOCK_KEY.ICO
Function
Name: xxx_po_wf_XXAATRNG_pkg.set_wf_approve_role
Function
Type: PL/SQL
Result
Type: None
In same
way, add all the functions needed to complete the workflow.
Add
notification activity and provide following information in the fields of the
pop up window:
Item
Type: XXAATRNG Workflow
Internal
Name: PO NOTIF INFO
Display
Name: PO NOTIF INFO
Icon:
NOTIFY.ICO
Message: PO
Information
Now right
click on validate PO and drag till end activity, it will prompt for a result
Yes/. Same needs to be done for other functions as well. After completing all
the validations, it will look like as shown below:
Initiating a process
To initiate
a process, first we need to call the set of APIs for initiating a WF. For
reference, code is given below:
PROCEDURE
start_XXAATRNG_wf(p_po_id IN INTEGER) IS
l_itemtype
VARCHAR2(30) := 'XXXWF';
l_itemkey VARCHAR2(300) := 'XXAATRNG-'
|| p_po_id;
CURSOR
c_get IS
SELECT *
FROM xxxx_po_headers
WHERE po_id =
p_po_id;
p_get
c_get%ROWTYPE;
BEGIN
OPEN
c_get;
FETCH
c_get
INTO p_get;
CLOSE
c_get;
wf_engine.createprocess(l_itemtype,
l_itemkey, 'XXAATRNG_WORKFLOW');
wf_engine.setitemuserkey(itemtype
=> l_itemtype
,itemkey => l_itemkey
,userkey => 'USERKEY:
' || l_itemkey);
wf_engine.setitemowner(itemtype
=> l_itemtype
,itemkey =>
l_itemkey
,owner => 'SYSADMIN');
wf_engine.setitemattrnumber(itemtype
=> l_itemtype
,itemkey =>
l_itemkey
,aname => 'PO_ID'
,avalue =>
p_po_id);
wf_engine.setitemattrtext(itemtype
=> l_itemtype
,itemkey
=> l_itemkey
,aname => 'SEND_TO_EMAIL'
,avalue =>
p_get.send_email_to);
wf_engine.setitemattrtext(itemtype
=> l_itemtype
,itemkey =>
l_itemkey
,aname => 'PO_DESCRIPTION'
,avalue =>
p_get.po_description);
wf_engine.startprocess(l_itemtype,
l_itemkey);
END
start_XXAATRNG_wf;
Procedures and Functions
Oracle
workflow lets you integrate your own custom PL/SQL procedures and functions in
your workflow procedures.
All PL/SQL
stored procedures that are called by function or notification activities in an
oracle workflow should follow standard API format.
procedure
<procedure name> (itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
resultout
out varchar2) is
Itemtype
-> It is an internal name of your workflow process.
Itemkey
-> It is a unique key generated for each instance of your WF process.
Actid ->
It is an id number of the activity fro, which this procedure is called.
Funcmode
-> It is an execution mode of an activity. If the activity is function then
funcmode will be run or cancel.
Resultout
-> If a result type is specified in the Activities properties page for the activity
in the Oracle Workflow Builder, this parameter represents the
expected
result that is returned when the procedure completes.
resultout
:= ’COMPLETE:<result>’;
resultout
:= ’COMPLETE’;
resultout
:= wf_engine.eng_timedout;
resultout
:= WAITING
Application Navigation:-
Go to
Workflow Administrator Responsibility -Ã Status Monitor Ã
Open the form.
Enter the
workflow type à XXAATRNG Workflow in our case. Then
press GO button.
All the
processes which we run will be displayed with the unique item key as shown in
the below mentioned picture.
Select one
of the process and click on Active History. The details will be seen which we
have filled in the API at the time of insertion in the table. As you can see
the performer in the below attached screenshot, the mail will go the mentioned
ID.
Now go back
and click on the status diagram, the latest workflow process will be displayed
as.
Click on
each function to know the definition, Usage, Status and Notification.
Go Back and
click on Workflow Details:-
You will
able to see the Workflow Attributes and Workflow Definition as shown below.
Pls Note:-
Mailer
Notifications should be ON, incase you want to receive mails , in above case
the mailer notification is DOWN, hence not able to receive mails.
Please
follow the below navigation to know whether mailer is ON/OFF.
Go to
Workflow Administrator Web Applications -Ã Workflow Manager.
Check the
Notification mailer as shown below.
Access/Protection/Customisation
Oracle
protects some key business critical activities from being modified using this
concept.
We can
preserve customizations using this concept.
The access
levels are defined as follows:
0 -
9 Reserved for Oracle Workflow.
10 -
19 Reserved for Oracle Application Object Library
20 -
99 Reserved for Oracle E-Business Suite.
100-999
Reserved for customer organizations
1000
Public
So Oracle
Corp. developer will always work at access level of 20.
He created
an activity and doesn’t want customer to change as it is critical activity of
the flow.
First he
set access level at 20.
Properties
of validate po activity
To prevent
from modification he will lock at this level.
Now at
customer site, developer will work at access 100.
Properties
of po validity activity.
Access 100
is not between 0 to 20.so he will not be able to modify this activity.
Now Oracle
Corp. developer works at an access level 20 and change the lock property so a
developer at customer site can customize the activity.
Now
protection is 1000 means it is public.
At customer
site, developer can modify this activity if he works at an aceess level between
0-1000.
Now
developer at customer site customize the activity and want to preserve
customization been done.
Now lock at
this level.
Now, Oracle
corp. developer can’t modify this activity since it is been locked at 100. and
20 is not between 100-100 or 100-1000.
Hence
oracle patch can’t modify this activity.
However by
checking allow modifications of customized objects .They can customize these
activities as well.
WFLOAD COMMAND
Oracle
delivers workflows via patches which use WFLOAD command to load their
definitions to the database.
Syntax:
WFLOAD
apps/apps_pwd 0 Y < UPLOAD_MODE> WFDEMO.wft
Different
upload modes are:
UPGRADE -
Honours both protection and customization levels of data
UPLOAD
- Honours only protection levels of data
FORCE -
Force upload regardless of protection and customization levels.
To
download, issue a command
WFLOAD
apps/apps_pwd 0 Y DOWNLOAD WFDEMO.wft
XXXXPTR
3 comments:
Excellent Notes..Thanks you very much
Thanks i want to learn workflow your notes is enough or any extra things have to learn in workflow
Appreciate your efforts..... Now i got basic idea in WF process.
Post a Comment