Embed Size (px)
Transcript of Workflow Training
Workflow TrainingINDEX 1. Overview of workflow 2. Workflow Process Components Item Types Lookup Types Messages/Notifications Attributes 3. Workflow process Diagram Process Window Transitions Start and end activities Initiating a process 4. Procedures and Functions 5. Application Navigation 6. Access/protection/customisation 7. WFLOAD command
Overview of workflowWhy 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 ComponentsDepending 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
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: Training Workflow Description: Training 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.
AttributesAttributes are like a global variable which are required to store information necessary to complete wf process. For example, PO Number, PO description, send 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 Training 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 TypesIt is just a static list of values which can be referenced by activities, notifications etc.
MessagesThe 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 DiagramTo 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 activitiesEvery 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.
TransitionsIt 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 abovementioned 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: Training Workflow Internal Name: SET_ROLE Display Name: Set Role Icon: LOCK_KEY.ICO Function Name: xxx_po_wf_training_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: Training 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 processTo initiate a process, first we need to call the set of APIs for initiating a WF. For reference, code is given below: PROCEDURE start_training_wf(p_po_id IN INTEGER) IS l_itemtype VARCHAR2(30) := 'XXXWF'; l_itemkey VARCHAR2(300) := 'TRAINING-' || 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, 'TRAINING_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_training_wf;
Procedures and FunctionsOracle 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 (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:; resultout := COMPLETE; resultout := wf_engine.eng_timedout; resultout := WAITING
Go to Workflow Administrator Responsibility - Status Monitor Open the form. Enter the workflow type Training 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