add

About Me

My photo
Oracle Apps - Techno Functional consultant

Tuesday, November 22

WORKFLOW

Workflow is an automation of a business process, i.e tasks are transferred from one activity to another activity according to some rules specified.

Workflow builder is a tool in which we can create a new process or open an
Existing one from an instance and make modifications to it. It contains a navigator window in which we can define components of an item type and process window to draw the process diagram.

Opening and saving workflow: 
To open a workflow, first we need to open workflow builder then from the File Menu options select open. We will get a window in which it will ask options whether the file is to be opened from the local system or from instance. If the workflow is in local system then give the file name and click Ok, the workflow will appear in the navigator window and if it is in Instance then give the username and password it will give the list of workflows, select the required one and click ok the file will appear in the navigator window.

Creating new item Type:

To create an item type, choose file menu and select new it will provide a work space to create an item type then right click on it and select new item type.A new window will appear asking for internal name, display name and other details about
Item type fill the necessary fields and click ok.
After creating an item type we need to define attributes, functions, messages, notifications, look up codes to define a process.

Creating item attributes:

To create an item attributes, right click on attributes and select new attribute
a window will pop up asking for the internal name and display name of the
attribute and type of the attribute.
The different types of attribute for an item type are:
Text: we can create an item attribute of type text by selecting the type as TEXT and we Can give any text in the value field.
Number: select the type as number and give the number value in value field.
Date: select the type as Date and specify the date format. Give the date in
Value field.
URL: select the type as URL and give the url in message attribute specifying
the type as URL.
Similarly we can create form, lookup, event attributes by selecting the type as
Form, look up and event.


Creating a simple process.

Lets create a simple process with three activities start, add and end.
To create start activity, right click on the functions and select new function
A window will pop up, give the internal name, display name, function name
And type as pl/Sql. The function name should be written in the form
<Package name>. <Function name>. Click ok the function start is created and
it appears in function tab.

Simple process with ADD function

To create an add function, first we need to create two attributes of type
Number and another attribute of type number to store the result. After that
Create a function ‘add’ by right clicking on function and selecting new function.
Give the function name as <package>.<internal name> and mention the
Result type for this activity if there are any.
Create an end function in the same way as we did for start function. Give the
Function name as <package name>.<Internal name>.

After creating functions, right click on process and select new process. we should
give the process internal name and display name. A new process tab appears in
the navigator tab, On double clicking on it the process window appears. In it select
the function button in the tool bar of process window and click it in the workspace
Where we want to place this function. Select the function name and that function
Icon will appear in the workspace where we clicked. Like this we should select start, add and end functions and place them where we want. Every process should begin
With start activity, from there we should join other activities by transition arrows.
Join start with add function and add function with end function.
In process diagram window select start activity and select properties, In it select
The node tab and mention the start/end field to start indicating that it is start
Activity. In the same way we should mention start/end field as ‘end’ in the node
Tab of end activity properties.
Validate the workflow before saving it to the instance and if there are any errors
Try to resolve them. After successful validation of workflow create a package
With procedures for start and add activity. In start activity procedure give a unique
Item key and write two statements to create and start procedure with activity name
And process name. In add procedure try to get the value of the attribute by using

Getitemattrnumber () add the numbers and keep the result in (io_result) in out parameter. The result should be displayed in the attribute created in the workflow builder and it is done by setitemattrnumber() and at last end the package.
Try to run the workflow using <package name>.<start activity name>; and see the
Output in the backend table wf_process_activities and wf_item_activity_statuses.
The result addition of two numbers is shown in the result_code column of wf_item_activity_statuses. If there is any error in the workflow we can see the error message in the wf_item_activity_Statuses table and also in the front-end application
The error is shown in the status monitor tab, specify the item_type in the field and
Clicks go .It will display the status of the workflow whether it is completed or error
click on the workflow to see the error if it is not completed or else see the status of
the activities in the workflow, how the flow is in the process. The green line indicates that the process is completed and the grey line indicates that the process is not yet
Started. The flow will be in green if the process is successfully completed.


Creating look up types:

The looks up types are mainly used in activities which has more than one result type
In order to continue the flow in the process according to the favorable conditions
Of the business situations the activities will make use of the look up types. There are
Many look up types available in the standard workflow, which we have to make use.
They can be included in our process by dragging the look up type from the standard type to the item type’s look up type, which we are creating. In order to create a new
Lookup code, right click on the look up type and select new, give the correct internal name and display name. After creating the look up type right click on it and create
Look up code and fill the necessary details. The different types of look up types available in the workflow standard are: wfstd_yes_no, wfstd_approval, wfstd_Boolean,and many more.

Creating a process with result type assigning to activities:

Lets create a process with one activity assigned a result type of yes or no
And depending on the result of the activity, the branches are assigned to the different activities. In our workflow we have assigned the activity to another
Function if the result is no and if the result is yes then the activity is branched with
Notification activity that sends the message to the user defined in the attributes.
 
Process with yes/no look up code.

At first create an item type by using quick wizard, which will create automatically
Start and end functions. After creating the item type, create attributes that are required in our process. Create item attributes of number type as input and one
Attribute type of number to store the result in it. Create another item attribute of
Type text and give username of the instance in the default value field. Another item attribute of type number is created depending on which the result type of the
Function3 is decided.
To create the function AA_FUN3 right click on the functions tab and select new function .A window will pop up, fill the internal and display name of the function
and the function name should be written as <package>. <Function name>. Mention the result type field as yes/no i.e. the output of the AA_FUN3.
Create another function AA_FUN4 by right clicking on the functions tab and select new function. Fill the internal and display name of the function, mention the result type as none as there is only one output for this function.
We need an ‘or’ function to forward the flow if the result type is any one of them and is copied from wfstd_functions by dragging it on to the functions tab of the current
Item type.

Creating messages:

To create a message, right click on the message tab of item type and select new message. A window will pop up and fill the internal name and display name of the message, if we want we can enter the message content in the description field or
in the body with subject as the display name. We can include the message attributes
in the message body by putting ampersand sign before message attribute name.
we can include any text defined in the item attributes by including the item attribute in the message attribute value field.
We need to create message attribute to include any text in the message body and to create it right click on the message and select new attribute, a window will appear in that provide an internal name in capital and display name and select type as text.
To include the item attribute in the message body, in the default region select type as item Attribute and include in the value the attribute that we want to include in the message body.

Creating Notification:

To create Notification, right click on the notification and select new notification a new
Window will appear. In that form provide Internal name in caps and display name,
Include the result type if there is any and select the message that is needed to send to the user. We can send messages to more than one performer by selecting expand roles.

Process window:

In process window, we will draw the diagram of the workflow which will show the
Flow of work from one activity to another. We need to create functions by selecting the function button on the toolbar of the process window and click it on the workspace where we need to include the function in the flow, a window will pop up
Select the function and click ok. After placing all activities in the process window, draw transitions from one activity to other according to the flow of work. Go to the properties of the notification and give the performer from whom this notification should get approved.
Validate the workflow before saving it to the instance and if there are any errors
Try to resolve them. After successful validation of workflow create a package
With procedures for start and add activity. In start activity procedure give a unique
Item key and write two statements to create and start procedure with activity name
And process name. In the function AA_FUN3, try to get the attribute order value by using getitemattrnumber () and store it in result in out parameter. If the order is greater than zero than the fun3 returns yes else No. Depending on the result of fun3 the fun4 activity or notification will be activated and the flow will go through end activity and stops. In activity fun4 we are getting two attribute values by using getitemattrnumber (), adding them and storing the result in an attribute. The result can be checked in the backend table wf_item_activity_statuses. We can see the status of the workflow in the application in status monitor tab by providing the internal name and click go. Will see the flow of work occurred in green lines and gray lines indicate that the flow doesn’t happen in that direction.

Creating a Workflow process with URL type attribute:

To create a process with item attribute as URL type, at first we need to create an item type using quick wizard. Then right click on item attribute and select new item attribute, a window will appear in which we need to give all the details about that attribute. Give the internal name and display name and select the type as URL and the frame target which ever is favorable and click ok. Now create another item
Attribute of type text and give the username in the default value field then press ok.
Workflow process with URL attribute.

Creating message:
To create a message, right click on the message tab of item type and select new message. A window will pop up and fill the internal name and display name of the message, if we want we can enter the message content in the description field or
in the body with subject as the display name. We can include the message attributes
in the message body by putting ampersand sign before message attribute name.
We can include any text defined in the item attributes by including the item attribute in the message attribute value field.
We need to create message attributes to include any text in the message body and to create it right click on the message and select new attribute, a window will appear in that provide an internal name in capital and display name and select type as text.
To include the item attribute in the message body, in the default region select type as item Attribute and include in the value the attribute that we want to include in the message body.
In meess1 message type, include the message attribute mess1 using ampersand sign in the body or description part of the message and create the message attribute mess1. Provide the internal name, display name, the type as URL and give the url in the default value.

Creating notification:
To create Notification, right click on the notification and select new notification a new
Window will appear. In that form provide Internal name in caps and display name,
Include the result type if there is any and select the message that is needed to send to the user. We can send messages to more than one performer by selecting expand roles.

Now right click on the process tab and select new process, provide the internal name and display name and click ok. Double click on the process created, a new window will appear with tool bar provided. Select the notification button from the tool bar

And click it on the workspace provided and include the notification name in the form opened after clicking button. Draw transition from start activity to notification and from notification to end activity, get back to navigation window and validate the workflow process. After successful validation of the process create package with start activity and end activity. In start activity procedure give a unique Item key and write two statements to create and start procedure with activity name and process name.
Now try to run the workflow created by using Execute <package name>. <Start activity name>. We can see that the notification is sent to the username provided in the performer of notification. In notifications tab a reference message will be seen, on clicking it we will see the URL mentioned in the attribute.

Creating workflow process sending notification to E-mail id:

Create an item type by using quick wizard, right click on item attribute and select new attribute. A new window will pop up asking for internal name, display name,
The type of attribute and default value fields. Create an item attribute of type text
And include the email id in the default value region. Now create a message by right clicking on the messages and selecting the new message, give the internal and display name. Now right click on the message created and select new message attribute. Include this message attribute in the message body using ampersand sign
And write any message in the message body or in the description part of the message. Create a notification and include the message created in this notification
While creating notification the internal name should be in capital.
In the process window, click on the notification button and workspace where we want to place the notification and draw the transitions from start activity to notification
and from notification to end activity. Right click on the notification activity and select
Properties, from it select node tab and specify the attribute, which has email id in the performer value.
Now validate the workflow by clicking on the validate button in the tool bar and after successful validation create a package with start procedure with unique item key
And two statements to create and start process. Include a procedure in the package if there are any and try to run the workflow.
Now check the email id for any message if it is there we can take some actions by clicking on the link specified there, it will open the application and we need to give the Username and password and respond to that message.


Creating a process based on the result type comparison:

Lets create a process with one activity assigned a result type of comparison
And depending on the result of the activity, the branches are assigned to the different activities. In our workflow we have assigned the activity to another
functions if the result is equal, greater than, less than and null.

Workflow process AA_AITEM based on result type comparison.

Create an item type using quick wizard, two functions start and end will get created automatically. Right click on the item type and select new item attribute, a window will popup enter the internal name in capital and select the type as text. Here we are creating three attributes of number type and in one of them we are storing the result
and three attributes of type text out which two are for holding the usernames and other one is for storing the result greater than, less than or equal.
Now create the functions by right clicking on the function tab and select new function
Provide the internal name, display name, description about function and function name should be written in the form <package name>. <Function name>.For function AA_FUN1 include the result type as comparison so that based on the result of this function the flow will go through different paths.

To create a message, right click on the message tab of item type and select new message. A window will pop up, fill the internal name and display name of the message, if we want we can enter the message content in the description field or
in the body with subject as the display name. We can include the message attributes
in the message body by putting ampersand sign before message attribute name.
We can include any text defined in the item attributes by including the item attribute in the message attribute value field.
We need to create message attribute to include any text in the message body and to create it right click on the message and select new attribute, a window will appear in that provide an internal name in capital and display name and select type as text.
To include the item attribute in the message body, in the default region select type as item Attribute and include in the value the attribute that we want to include in the message body.
Here we are creating two message attributes to include two messages to two different users. After creating the message attributes create two notifications for two different users and include the message attributes into two notifications.

In process window, we will draw the diagram of the workflow indicating the flow of work from one activity to another. In the tool bar of process window click on the function button and on the workspace where we want to place the function.
On indicating the function name it will appear in the workspace where we have
Clicked. Likewise place all the functions in the workspace and draw the transitions from one activity to another activity according to flow of work. Depending on the result of the function AA_FUN1 it will take one result type and takes one path from the workflow. Include or function in the flow, which will continue the flow even if only one function gets activated. Now validate the workflow process by clicking on the validate button on the tool bar of navigator window.
After successful validation of the process, save the process to the instance and create a package with four procedures AA_FUN1,AA_FUN2,AA_FUN3,AA_FUN4.
Create start process with unique item key and two statements indicating the start and creation of the process. In procedure AA_FUN1 get the numbers by using getitemattrnumber () and try to compare those two numbers. If two numbers are equal then AA_FUN2 will gets activated and this function will add two numbers by getting them using getitemattrnumber and displays the result using setitemattrnumber (). If the result is greater than, then function AA_FUN3 will gets activated and it will multiply the number and returns the result. If the result is less than, then function AA_FUN4 will gets activated and this function will calculate the factorial of a number. I f no number is entered in the attributes value then AA_FUN1 function will return null value based on this value, a notification is issued to the user
And he will respond according to the message in the notification.
Now try to run this process and see the tables affected.

The base tables for workflow are:

WF_PROCESS_ACTIVITIES

WF_ITEM_ACTIVITY_STATUSES

WF_ACTIVITIES (properties of process/functions/events)

WF_ITEM_ATTRIBUTES (attribute values)

WF_ITEM_ATTRIBUTE_VALUES (results of attributes)

WF_ITEM_TYPES (properties of item type)

WF_EVENTS (about events)

WF_MESSAGES

WF_MESSGE_ATTRIBUTES

WF_NOTIFICATIONS

WF_NOTIFICATION_ATTRIBUTES

WF_LOOKUP_TYPES_TL

WF_ACTIVITY_ATTRIBUTES

WF_ACTIVITY_ATTR_VALUES

WF_ACTIVITY_TRANSITIONS

The base tables, which gets affected when we create and run workflow processes are:

WF_ITEM_ACTIVITY_STATUSES

WF_PROCESS_ACTIVITIES

No comments: