Thursday, February 19, 2015




The level of access can be set in Workflow Builder and developers need to set access levels as defined in the following list:
·         0-9 is reserved for Oracle Workflow
·         10-19 is reserved for Oracle Application Object Library
·         20-99 is reserved for Oracle E-Business Suite
·         100-999 is reserved for customer specific extensions
·         1000 is reserved for public

An object will be locked to users that have a higher protection level than the object. You can see this as there is a padlock against objects that you do not have the access level to modify. The access level defaults to 100 and as an e-Business Suite developer, we always operate with an access level of 100. The access level can be modified by navigating to Help | About Oracle Workflow Builder as shown in the following screenshot:


 

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 “XX First Workflow” and click OK

Right click on WFSTD and select New Item type


Enter the fields as below for Creating Item Type

Internal Name: XXFSTWF

Display name= XX First Workflow

 


Creating Process

Internal Name:  XXFSTPCS

Display name= XX First Process

 


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


Right click on Process and click on New Process


 

Enter the fields:

Internal Name: XXFSTPCS

Display Name: XX First Process

We need to create a new Runnable Process so that we can call it from PLSQL/Form/OAF/Java. Under a Process there can be any number of sub process depending upon the complexity of the workflow logic that needs to be implemented.

 


 

To Design any Process in Workflow it should start with One start Function and we get it from WFSTD. Just we need to drag and drop the start and end functions from the Standard Functions

Drag and drop the Start and END Functions from the standard Workflow.

 


 

After Drap and Drop Right click Start Function and click on Node Tab and change the value Start/End to Start.


Similarly change the properties of the end function

Note: Any Process can have only one Start but can have any number of ends depending upon the Business logic’s complexity.

Now we need to create a Custom Function that has the business logic. You can have the Function call your plsql function or Java Class or any external application. We can mention the PLSQL Function Name in the Function Name field in the properties of the Function.


 


Once the function is created just drag and drop the function between START and END Functions. Once the Function is placed just by using right click of the mouse draw the Flow how the process to be. Always The Process would be starting from Start and No Functions can be in the Process without coupling to another in the flow. Always the flow should end using and END function

 


Now Verify the workflow and save in the data base or the (desktop and upload using wfload.)

Once the workflow is saved in the data base which usually takes time we can test it using below queries:

SELECT * FROM wf_item_types WHERE name = 'XXFSTWF';

SELECT * FROM WF_PROCESS_ACTIVITIES WHERE process_item_type = 'XXFSTWF';

The data in WF_PROCESS_ACTIVITIES table explains the complete details of the workflow item type. Like how many Process, Functions, etc. with its versions.

Table Script


Package Script


Sample Script to Trigger the workflow:


We can see the Activity status of the workflow by using below query by passing item_key

select * from wf_item_activity_statuses where item_key like 'XXFST-321';

 

If any error in the workflow we can rewind the workflow from Applications or from Database (By using API)

Sample Script to Revision the workflow:


 

 Steps to Create Workflow with Approval Notification:

Open the existing workflow which is created above from the database or by using WFLOAD


Save the file on the desktop


Once the workflow file is saved on the desktop, Now we will be modifying that wft.

The Agenda is to send an email notification to one person using Oracle workflow.

For this we are going to create an Item Attribute which is similar to a Global Variable in a PLSQL Package. There are different types of item attributes like Text, number, date, lookup, form, url, document, role, attribute and event. Here we are selecting a text. We can even go for a Role type but then we need to create a role and assign it then to the attribute.

 

Attributes: Attributes acts like a global variable that can be referenced or updated by any activity with in a process.

 


Set the item attribute properties

 


Once the attribute is created then create a new message which needs to be send in the notification.


Set the properties of the new message:

 


 

In the Tab Body the actual email notification Body and in the subject the email notification subject goes in.


As we are using standard Approve/Reject notification we are selecting an existing lookup. Else if we want to create a new, we can always create a new look up with its values and use it here.

Add the display name and description which are mandatory for the Message

 


Create a new notification by using right click on the notifications menu.


Set the Notification properties


Select the Message which we have created.

Drag the item attribute to the message as we are using the item attribute in the message

 


Now edit the Main Process  to add the new Notification:

Form a link between Function and notification:

Drag the Notification which we created into the process and link the process to notification.

 


Edit the properties of the Notification to add the performer.


In the node change the Performer type to Item attribute as we intent to set the attribute value from function and link the process to end.



Validate and save the workflow in the database or on the desktop and upload it using WFLOAD.


 

If the Notification Mailer is up we will receive the notification via email to the role which we assigned to the attribute or we can check the notification in the application.


 

 


Role in Oracle Workflow
In Oracle workflow we need a role for notification activity. Workflow engine calls the notification system to deliver a notification message to an appropriate role. Once user of that role completes the notification response, the workflow Engine continues to drive through the remaining activities in process

We can create adhoc roles manually and can add any number of users to the roles.

Sample Scripts

                                 

Package script with setting the Attribute value


Viewing Workflow status diagram in Applications

We can view the process flow of our workflow in application level by following below steps

Login To Applications

Go to the Navigation SystemAdministrator - > WorkFlow -> Administrator WorkFlow -> Status Monitor


 

Below Form will open


 

Give Workflow Internal Name and Item Key which processed and click on GO


 


 

Click on Status Diagram Tab to view the process flow of the Workflow.


 

Firing Notifications Based on the Action

Create 2 messages XXFST_APPROVE AND XXFST_REJECT and 2 notifications XXFST_APP_NOTIF(Attach  XXFST_APPROVE  Message for this )and XXFST_REJ_NOTIF(Attach  XXFST_REJECT Message for this ) .


 

 


Edit the process and delete the selection from Notification to END in the process.

 


Edit the Properties of the notification and change the result type to Approval.

 


 

Now try to create the link between Notification and END it will prompt you to proceed with some action.


 

Drag the Notification XXFST_APP_NOTIF  in the process and select the action Approve and direct  the process to the notification XXFST_APP_NOTIF and from approval notification to END .


Drag the Notification XXFST_REJ_NOTIF in the process and select the action Reject and direct the process to the notification XXFST_REJ_NOTIF and from approval notification to END.


Change the performer in the node tab for the notifications XXFST_REJ_NOTIF and XXFST_APP_NOTIF which we created.

 


 

Save the Workflow in the Database and trigger it by using triggering script.

After triggering the workflow we can see the Notification in applications home page

 


Open the Message and click on Approve button.

 


Once approving the Notification we will receive the Approve Message

 


 


 

Process flow diagram for Approval Process

 


Similarly we can test the Reject functionality.

Trigger the Workflow open the message and click on reject Button.

 


 

Once Rejecting the Notification we will receive the Reject Message

 



Process flow diagram for Rejection Process


 

Loop Counters

Loop Counter activity used to limit the number of times the Workflow Engine transitions through a particular path in a process. The Loop Counter activity can have a result of Loop or Exit.

Using Loop Counters in Notifications

Scenario : If the Notification is rejected 3 times then it should come out of the loop and trigger the new notification.

Create new message XXFST_MAX_REJC .

 


Create new Notification XXFST_MAX_REJC_NOF and attach the message which we created

 


Open the process and create new function Loop counter by right clicking.

 


Set the Loop counter value in the tab node Attributes Tab

 


 

Drag the Notification XXFST_MAX_REJC_NOF into the process and give the performer in the node tab.

Implement the Loop counter in Reject process as shown in the screen shot below


The above process states that if the Rejection happens then it will loop for 3 times and fire the same notification 3 times. Once it reaches the Maximum Limit it will exit and send the new Notification which we created.

After triggering the workflow we can see the Notification in applications home page


Open the notification and Reject it will fire the Notification Again.

 


Open the notification and Reject it twice, after reaching the maximum point of rejections it will fire the new Notification. In the below screen shot we can see that we rejected the Notification 3 times

 


 


 


Process Flow Diagram


 

TIME OUT IN NOTIFICATIONS

In this section we will see setting the TIME OUT option in Notification. The Main purpose of using this functionality is to deviate the process if no action is taken with in the specified time limit.

Create a Message XXFST_TIMEOUT and Notification XXFST_TIMEOUT_NOTIF and attach the new message.


 

Open the process and edit the properties of the Notification XX First Notification and click on Node Tab and set the time to 10 minutes as mentioned in the below screen shot


 

Drag the Notification XXFST_TIMEOUT_NOTIF into the process and Delete selection from the Notification XX First Notification.

 


Try to connect the selection from the Notification XX First Notification we will get Timeout Action along with Approve and Reject.

 


Now create the selection for APPROVE, REJECT and TIME OUT as mentioned in the below screen shot.

 

Save the Workflow in the Database and trigger it by using triggering script.

As we set the time to 10 mins, if no action is taken on this Notification the Timeout Notification should trigger.

As we are running this in Development Instance we have to submit Workflow Background Process Manually to trigger the Timeout Notification, in PRODUCTION Environment this program will be scheduled.

 


 

After completing this program we will receive the Timeout Notification.

LOOKUP TYPES:

Lookup Types are used to define our own Values in the lookup to use.

Create new Lookup Type XXFST_LOOKUP_TYPE.


Create Lookup Codes YES and NO  for the Lookup Type XXFST_LOOKUP_TYPE.


 


 

Creating selections based on the values in Lookup

Open the Process and edit the properties of the function XX First Function and attach the Lookup Type which we created in the Result Type of the Function.

 


 

Delete Selection from the function and create New Selection.

 


 


We have to return the values same as the lookup values from the Function INSERT_PROC in the package XXFST_PKG.

Modified Package Script


Process Flow Diagram