Workflow Training

  • Published on

  • View

  • Download

Embed Size (px)


<p>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</p> <p>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.</p> <p>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</p> <p>Item Types</p> <p>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:</p> <p>Open workflow builder, click on file menu then new to create new data store.</p> <p>Data store is nothing but a file that stores your WF definition. Save it with a name you desire.</p> <p>Right Click on data store created and select new item type</p> <p>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</p> <p>Now item type is created. Click on expand beneath item type in navigation tree to see components attached with item type.</p> <p>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:</p> <p>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</p> <p>Like this you can create as many attributes as needed.</p> <p>Look TypesIt is just a static list of values which can be referenced by activities, notifications etc.</p> <p>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</p> <p>Click on Body tab to define body of a message.</p> <p>Suppose we want to give the description of the PO also along with the message, then copy the attribute with &amp; as a prefix . To have PO description in a message simply drag an item attributes PO_DESCRIPTION number and drop under current message.</p> <p>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</p> <p>After providing values for the above mentioned fields, double click on the process you have just created. A process window opens.</p> <p>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.</p> <p>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:</p> <p>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:</p> <p>Same needs to be done for adding end activity.</p> <p>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.</p> <p>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</p> <p>After providing values in the abovementioned fields, process window look like this :</p> <p>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:</p> <p>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:</p> <p>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</p> <p>In same way, add all the functions needed to complete the workflow.</p> <p>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</p> <p>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:</p> <p>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</p> <p>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 =&gt; l_itemtype ,itemkey =&gt; l_itemkey ,userkey =&gt; 'USERKEY: ' || l_itemkey); wf_engine.setitemowner(itemtype =&gt; l_itemtype ,itemkey =&gt; l_itemkey ,owner =&gt; 'SYSADMIN'); wf_engine.setitemattrnumber(itemtype =&gt; l_itemtype ,itemkey =&gt; l_itemkey ,aname =&gt; 'PO_ID' ,avalue =&gt; p_po_id); wf_engine.setitemattrtext(itemtype =&gt; l_itemtype ,itemkey =&gt; l_itemkey ,aname =&gt; 'SEND_TO_EMAIL' ,avalue =&gt; p_get.send_email_to); wf_engine.setitemattrtext(itemtype =&gt; l_itemtype ,itemkey =&gt; l_itemkey ,aname =&gt; 'PO_DESCRIPTION' ,avalue =&gt; p_get.po_description); wf_engine.startprocess(l_itemtype, l_itemkey); END start_training_wf;</p> <p>Procedures and FunctionsOracle workflow lets you integrate your own custom PL/SQL procedures and functions in your workflow procedures.</p> <p>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 -&gt; It is an internal name of your workflow process. Itemkey -&gt; It is a unique key generated for each instance of your WF process. Actid -&gt; It is an id number of the activity fro, which this procedure is called. Funcmode -&gt; It is an execution mode of an activity. If the activity is function then funcmode will be run or cancel. Resultout -&gt; 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</p> <p>Application Navigation:-</p> <p>Go to Workflow Administrator Responsibility - Status Monitor Open the form. Enter the workflow type Training Workflow in our case. Then press GO button.</p> <p>All the processes which we run will be displayed with the unique item key as shown in the below mentioned picture.</p> <p>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.</p> <p>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.</p> <p>Go Back and click on Workflow Details:You will able to see the Workflow Attributes and Workflow Definition as shown below.</p> <p>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.</p> <p>Access/protection/customisationOracle 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 doesnt want customer to change as it is critical activity of the flow.</p> <p>First he set access level at 20.</p> <p>Properties of validate po activity</p> <p>To prevent from modification he will lock at this level.</p> <p>Now at customer site, developer will work at access 100.</p> <p>Properties of po validity activity.</p> <p>Access 100 is not between 0 to 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.</p> <p>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.</p> <p>Now developer at customer site customize the activity and want to preserve customization been done.</p> <p>Now lock at this level.</p> <p>Now, Oracle corp. developer cant modify this activity since it is been locked at 100. and 20 is not between 100-100 or 100-1000. Hence oracle patch cant modify this activity.</p> <p>However by checking allow modifications of customized objects .They can customize these activities as well.</p> <p>WFLOAD COMMANDOracle delivers workflows via patches which use WFLOAD command to load their definitions to the database. Syntax: WFLOAD apps/apps_pwd 0 Y &lt; UPLOAD_MODE&gt; WFDEMO.wft Different upload modes are: UPGRADE - Honours both protection and customization levels of data UPLOAD - Honours only protection levels of data</p> <p>FORCE - Force upload regardless of protection and customization levels. To download, issue a command WFLOAD apps/apps_pwd 0 Y DOWNLOAD WFDEMO.wft XXXXPTR</p> <p>THANK YOU!!!!Prepared by:-</p> <p>Anoop Jain</p>