Sunteți pe pagina 1din 23

1. What is Oracle workflow?

Oracle Workflow is a complete workflow management system that facilitates


business process reengineering. Oracle Workflow automatically processes and
routes information of any type, according to business rules you can easily
change, to any person inside or outside your enterprise. You can easily include
customers and suppliers in your workflow using the Internet and the
Worldwide Web.

2. What are the rules supported by Workflow?

Looping, Branching and Parallel Flow.

3. What are the components of workflow?

          1. Workflow builder.


          2. Workflow Definitions Loader.
          3. Workflow Notifications System
          4. Workflow Engine
          5. Workflow Monitor

4. What is workflow builder?

Oracle Workflow’s graphical Workflow Builder lets you create, view, or modify
a business process with simple drag and drop operations. Using the builder,
you can create and modify reusable workflow objects, including activities,
rules, messages, and users.

5. What is the function of workflow definitions loader?


The Workflow Definitions Loader is a utility program that moves workflow
definitions between database and corresponding flat file representations.

6. What is workflow monitor?

The Workflow Monitor displays an annotated view of the process diagram for
particular instance of a workflow process, so that users can get graphical
depiction of their work item status. The Workflow Monitor also displays a
separate status summary for the work item, the process, each activity in the
process.

7. What is Workflow Engine?

The Workflow Engine embedded in the Oracle8 server monitors workflow


states and coordinates the routing of activities for a process. Changes in
workflow state, such as the completion of workflow activities, are signaled to
the engine via a PL/SQL API or a Java API. Based on flexibly–defined workflow
rules, the engine determines which activities are eligible to run, and then runs
them. The Workflow Engine supports sophisticated workflow rules, including
looping, branching, parallel flows, and subflows.

8. Why do we require notification systems in workflow?

Notifications are used to handle activities that cannot be automated such as


approvals for requisitions or sales orders.

9. What is deferred process?


The workflow process run as background process is known as deferred
process.

10. Define an Item?

A specific process, document, or transaction that is managed by a workflow


process. For example, the item managed by the Requisition Approval Process
workflow is a specific requisition created by Oracle Internet Commerce’s Web
Requisitions page.

11. What are the item type attributes available in workflow?


          -Text
          -Number
          -Date
          -Lookup
          -Form
          -URL
          -Document
          -Role
          -Attribute

12. What is the purpose of directory services?

A mapping of Oracle Workflow users and roles to a site’s directory repository.

13. What is access level in workflow?


A numeric value ranging from 0 to 1000. Every workflow user operates at
specific access level. The access level defines whether the user can modify
certain workflow data. You can only modify data that is protected at a level
equal to or higher than your access level.

14. What is a process?

A set of activities that need to be performed to accom ness goal.

15. What are the two windows available in workflow builder?

Navigator Window.
Process Window.

16. What is a function activity?

An automated unit of work that is defined by a PL/SQL stored procedure.

17. What is Top Down design?

If you prefer to approach your design from a high level, you can first sketching
out the process diagram with activities, then go back later to create the
supporting objects for each activity.

18. What is Bottom Up design?

If you prefer to take a more programmatic approach to your design, you can
first define each of the supporting objects of your process before attempting to
create a higher level process diagram.
19. What are the types of Standard activities available?

And/Or Activities
Comparison Activities
Compare Execution Time Activity
Wait Activity
Block Activity
Defer Thread Activity
Launch Process Activity
Noop Activity
Loop Counter Activity
Start Activity
End Activity
Role Resolution Activity
Notify Activity
Vote Yes/No Activity
Master/Detail Coordination Activities
Wait for Flow Activity
Continue Flow Activity
Assign Activity
Get Monitor URL Activity

20. What is Noop activity?


The Noop activity acts as a place holder activity that performs no action. You
can use this activity anywhere you want to place a node without performing an
action. This activity calls the PL/SQL procedure named WF_STANDARD.NOOP.

21. What is the purpose of purging?

Deleting the workflow items which no longer needed by calling WF_Purge API.

22. What is   Lookup type?

A predefined list of values. Each value in a lookup type has an internal and a
display name.

23. What is persistence in workflow?

The amount of time the workflow item won’t be purged  even the activity is
completed.

24. What is ‘SEND’ attribute in workflow?

It is a type of message attribute defined as a ’Send’ source, a message attribute


gets replaced with a runtime value when the message is sent.

25. What is ‘RESPOND’ attribute in workflow?

It is a type of message attribute defined as a ’Respond’ source, a message


attribute prompts a user for a response when the message is sent.
26. What are the main workflow APIs?

WF_STANDARD
WF_ENGINE
WF_CORE
WF_PURGE
WF_DIRECTORY
WF_PREF
WF_MONITOR
WF_QUEUE
FND_DOCUMENT_MANAGEMENT
WF_NOTIFICATIONS

27. How to launch a workflow?

          1. Define workflow Items


          2. Define Workflow Process
          3. Draw Workflow Process Diagrams
          4. Then through System Admin Responsibility you can launch
your     Workflow
          OR
          Through Concurrent program
By writing a PL/SQL procedure which calls WF_ENGINE.CreateProcess,
WF_ENGINE.StartProcess, WF_ENGINE.LaunchProcess APIs we can
Launch a workflow.
28. What is Timeout in a workflow?

The amount of time during which a notification activity must be performed


before the Workflow Engine transitions to an error process or an alternate
activity if one is defined.

29. What is Transition in a workflow?

The relationship that defines the completion of one activity and the activation
of another activity within a process. In a process diagram, the arrow drawn
between two activities represents a transition.

30. Who is a Performer?

A user or role assigned to perform a human activity (notification). Notification


activities that are included in a process must be assigned to a performer.

31. What is a Role?

One or more users grouped by a common responsibility or position.

32. What is Cost in workflow?

A relative value that you can assign to a function or notification activity to


inform the Workflow Engine how much processing is required to complete the
activity.
Workflow Sample Tutorial
Overview: 
This article will illustrate how to create or define workflow 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 databasetrigger 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.
<![if !supportLists]>         <![endif]>Open WFSTD and save as new workflow
<![if !supportLists]>         <![endif]>Create Attributes
<![if !supportLists]>         <![endif]>Create Functions
<![if !supportLists]>         <![endif]>Create Notification
<![if !supportLists]>         <![endif]>Create Messages
<![if !supportLists]>         <![endif]>Create Roles
<![if !supportLists]>         <![endif]>Create database trigger
<![if !supportLists]>         <![endif]>Create PL/SQL Package
1) Open WFSTD and save as new workflow:

Navigation: File >> Open


Click Browse then navigate to Workflow installation directory
Navigation: Workflow Installation Directory\ WF\DATA\US\WFSTD
Now Click File >Save as, Enter "ErpSchools Demo" and click OK
Right click on WFSTD and select New Item type

Enter the fields as below


Internal Name: ERP_DEMO
Display Name: ErpSchools Demo
Description: ErpSchools Demo

Now you will see ErpSchools Demo icon in the Navigator


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

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

Enter the fields


Internal Name: ERPSCHOOLS_PROCESS
Display Name: ErpSchools Process
Description: ErpSchools Process
Double click ErpSchools Process Icon

2) Create Workflow Attributes:


Navigation:
Window menu > Navigator
Right click on Attributes and click New Attribute

Enter the fields


Internal Name: ERP_ITEM_NUMBER
Display Name: Item Number
Description: Item Number
Type: Text

Default Value: Value Not Assigned

Click Apply and then OK


Create one more attribute 
Right click on Attributes and click New Attribute
Enter the attribute fields
Internal Name: ERP_SEND_ITEM_FORM_LINK
Display Name: Send Item Form Link
Description: Send Item Form Link
Type: Form
Value: INVIDITM

Click Apply and then OK


3) Create Workflow Function:
Right click and then click on New Function

Properties window will open as shown below


Change/Enter the fields as below
Change Item Type to Standard from ErpSchools Demo
Select Internal Name as Start
Remaining fields will be populated automatically

Click Apply then OK

Again Right click on white space and click New Function 


Change the properties as below
Item Type: Standard
Internal Name: END

Click Apply and then OK

Right click on white space and then click New Function


Enter the fields
Internal Name: ERP_GET_DETAILS
Display Name: Get New Inventory Item Details
Description: Get New Inventory Item Details
Function Name: erpschools_demo_pkg.get_item_details

Click Apply and then OK

4) Create Workflow Notifications:


Right click on white space and then click New Notification
Enter fields
Internal Name: ERP_SEND_ITEM_DET
Display  Name: Send Item Detials
Description: Send Item Detials
Message: Sned Item Details Message

Click Apply and then OK


5) Create Workflow Messages:

Right  click on Message and click New 

Properties window will pop up as show below


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

Click Apply and then OK


Navigation: Window Menu > Navigator
Select Item Form Link Attribute
Drag and drop both attributes to "Send Item Details Message" 
6)
Create Roles: 
Adhoc roles can be created through PL/SQL 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
· Script to Create a Adhoc Role
· Script to Add user to existing Adhoc Role
· Script to Remove user from existing Adhoc Role
· Using Adhoc roles in workflow notifications
· Adhoc Roles Tables 
Script to Create a Adhoc Role
DECLARE
lv_role varchar2(100) := 'ERPSCHOOLS_DEMO_ROLE';
lv_role_desc varchar2(100) := ' ERPSCHOOLS_DEMO_ROLE';
BEGIN
wf_directory.CreateAdHocRole( lv_role,
lv_role_desc,
NULL,
NULL,
'Role Demo for erpschool users',
'MAILHTML',
'NAME1 NAME2′, –USER NAME SHOULD BE IN CAPS
NULL,
NULL,
'ACTIVE',
NULL
         );
dbms_output.put_line('Created Role' ||' '||lv_role);
End;
/

Script to Add user to already existing Adhoc Role


DECLARE
v_role_name varchar2(100);
v_user_name varchar2(100);
BEGIN
v_role_name := 'ERPSCHOOLS_DEMO_ROLE';
v_user_name := 'NAME3′;
WF_DIRECTORY.AddUsersToAdHocRole(v_role_name, v_user_name);
–USER NAMES SHOULD BE in CAPS
END;

Script to Remove user from existing Adhoc Role


DECLARE
v_role_name varchar2(100);
v_user_name varchar2(100);
BEGIN
v_role_name := 'ERPSCHOOLS_DEMO_ROLE';
v_user_name := 'NAME3′;
WF_DIRECTORY.RemoveUsersFromAdHocRole(v_role_name, v_user_name); –USER NAMES in CAPS

END;

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.
Tables:
· WF_ROLES
· WF_USER_ROLES
· WF_LOCAL_ROLES
· WF_USER_ROLE_ASSIGNMENTS
7) Launching workflow from PL/SQL:
First create a database trigger as below to call a PL/SQL procedure from which you kick off
the workflow.
<![if !supportLists]>         <![endif]>Create Database Trigger

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
DECLARE
lv_id                 NUMBER          := :NEW.inventory_item_id;
lv_item_segment1      VARCHAR2(100)   := :NEW.segment1;
lv_itemtype           VARCHAR2(80)    := :NEW.item_type;
lv_user_id            NUMBER          := -1;
lv_itemkey            VARCHAR2(10);
lv_orgid              NUMBER          :=2;
error_msg             VARCHAR2(2000);
error_code            NUMBER;
BEGIN
lv_user_id := fnd_global.user_id;
lv_orgid := fnd_global.org_id;
lv_itemkey := 1132; – This should be unique value

ERP_DEMO.LAUNCH_WORKFLOW('ERP_DEMO'
,lv_itemkey
,'ERPSCHOOLS_PROCESS' –process name
,lv_id
,lv_orgid
,lv_item_segment1
);
EXCEPTION
WHEN OTHERS THEN
error_code := SQLCODE;
error_msg  := SQLERRM(SQLCODE);
RAISE_APPLICATION_ERROR(-20150,error_msg);
END;
/

<![if !supportLists]>         <![endif]>Create PL/SQL Package to kickoff workflow

CREATE OR REPLACE PACKAGE APPS.ERP_DEMO IS
PROCEDURE LAUNCH_WORKFLOW
(
itemtype        IN VARCHAR2,
itemkey         IN VARCHAR2,
process         IN VARCHAR2,
item_id         IN NUMBER,
org_id          IN NUMBER,
item_segment1   IN VARCHAR2
);
END ERP_DEMO;
/
CREATE OR REPLACE PACKAGE BODY APPS.ERP_DEMO IS
PROCEDURE LAUNCH_WORKFLOW(
itemtype         IN VARCHAR2,
itemkey          IN VARCHAR2,
process          IN VARCHAR2,
item_id          IN NUMBER,
org_id           IN NUMBER,
item_segment1    IN VARCHAR2
)
IS
v_master_form_link varchar2(5000);
v_item_number varchar2(100);
error_code varchar2(100);
error_msg varchar2(5000);
BEGIN
v_add_item_id := ' ITEM_ID="' || item_id || '"';
v_item_number := item_segment1;
v_master_form_link := v_master_form_link || v_add_item_id;
WF_ENGINE.Threshold := -1;
WF_ENGINE.CREATEPROCESS(itemtype, itemkey, process);
-- Get the value of attribute assigned in workflow

v_master_form_link := wf_engine.getitemattrtext(
itemtype => itemtype
,itemkey  => itemkey
,aname    => 'ERP_SEND_ITEM_FORM_LINK');
- assign values to variables so that you can usethe attributes

v_master_form_link varchar2(5000) := v_master_form_link||':#RESP_KEY="INVENTORY"
#APP_SHORT_NAME="INV" ORG_MODE="Y" ';
v_master_form_link := v_master_form_link || v_add_item_id;
--set the attribute values in workflow so that you can use them in notifications

WF_ENGINE.SetItemAttrText(itemtype, itemkey, 'MASTERFORM', v_master_form_link);
WF_ENGINE.SetItemAttrText(itemtype, itemkey, 'ERP_ITEM_NUMBER', item_segment1);
-- start the workflow process

WF_ENGINE.STARTPROCESS(itemtype, itemkey);
EXCEPTION WHEN OTHERS THEN
error_code := SQLCODE;
error_msg  := SQLERRM(SQLCODE);
-- add dbms or fnd_output messages as required

END LAUNCH_WORKFLOW;
-- This procedure will just put the item number into workflow attribute ERP_ITEM_NUMBER

PROCEDURE GET_ITEM_DETAILS(
itemtype        IN VARCHAR2,
itemkey         IN VARCHAR2,
actid           IN NUMBER,
funcmode        IN VARCHAR2,
resultout       OUT NOCOPY VARCHAR2
    )
IS
v_GET_ITEM_NUMBER VARCHAR2(1000);
BEGIN
SELECT SEGMENT1 INTO V_GET_ITEM_NUMBER FROM MTL_SYSTEM_ITEMS_B WHERE ROWN
UM =1;
WF_ENGINE.SetItemAttrText(itemtype, itemkey, 'ERP_ITEM_NUMBER',v_GET_ITEM_NUMBER );
-- you can use the get function as below.
--v_GET_ITEM_NUMBER := wf_engine.getitemattrtext(
--                                                                             itemtype => itemtype
--                                                                            ,itemkey  => itemkey
--                                                                            ,aname    => 'X_ATTRIBUTE'
--                                                                            );
resultout:='COMPLETE:'||'Y';
exception when others then
dbms_output.put_line('Entered Exception');
fnd_file.put_line(fnd_file.log,'Entered Exception');
END GET_ITEM_DETAILS;
END ERP_DEMO;

S-ar putea să vă placă și