Workflow tutorial


Overview:

This workflow tutorial will illustrate how to create or define a new workflow from scratch including 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 database trigger 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.


1) Open WFSTD and save as new workflow:

alt

Navigation: File >> Open

alt

Click Browse then navigate to Workflow installation directory

Navigation: Workflow Installation Directory WFDATAUSWFSTD

Now Click File > Save as, Enter “ErpSchools Demo” and click OK

Right click on WFSTD and select New Item type

alt

Enter the fields as shown in below image

alt

Now you will see ErpSchools Demo icon in the Navigator

alt

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

alt


2) Create Process

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

alt

Enter the fields as shown in below image

alt

Click OK

alt

Double click ErpSchools Process Icon to open process window where we can draw our workflow diagram.

alt

Right click on process window and then click on New Function.

alt

Properties window will open as shown below

alt

Change/Enter the fields as shown in below image

Change Item Type to Standard. This is important as we are using START and END functions which came from WFSTD (Standard item type).

Select Internal Name as Start

Remaining fields will be populated automatically.

Go to Node tab and select “Start” from the drop down. This is mandatory and can’t be ignored.

alt

Click Apply then OK

alt

Again Right click on white space and click New Function

alt

Change the properties as below

Item Type: Standard

Internal Name: END

alt

Go to Node tab and select “End” from the drop down. This is mandatory and can’t be ignored.

Click Apply and then OK

alt

We will come back to this process window later after we have all components / activities ready to link. for now just close process window and go to navigator


3) Create Workflow Function:

Right click on white space  in the process window and then click New Function. Alternatively you can select Functions in Navigator and right click to get “New Function” option

alt

Enter the fields as shown in below image

alt

Click Apply and then OK

alt

We will join these activities later after we have our notification ready.


4) Create Workflow Attributes:

Navigation: Window menu > Navigator

alt

Right click on Attributes and click New Attribute

alt

Enter the fields as shown in below image

alt

Click Apply and then OK

Create one more attribute

Right click on Attributes and click New Attribute

alt

Enter the fields as shown in below image

alt

Click Apply and then OK.

Here INVIDITM form belongs to “Master Item” for from inventory module.

Now we have two attributes ready to use.


5) Create Workflow Messages:

click on Message and click New

alt

Properties window will pop up as show below

alt

Enter the fields

Internal Name: ERP_SEND_ITEM_DET_MSG

Display Name: Send Item Details Message

Description: Send Item Details Message

alt

Go to Body Tab and enter as shown below

alt

Click Apply and then OK

Navigation: Window Menu > Navigator

Select Item Form Link Attribute

alt

Drag and drop both attributes to “Send Item Details Message”. If you miss this step you will not be able to see the attribute values with in email.


6) Create Workflow Notifications:

Right click on white space in process window and then click New Notification

alt

Enter fields as shown in the below image

Message: Sned Item Details Message

alt

Click Apply and then OK


7) Create Roles and assign it to notification: 

Adhoc roles can be created through PL/SQL API’s 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

Alternatively you can use USERNAME directly with in the notification.

If you wish to create User Roles manually then follow the below articles

User Role Creation through API: WF_DIRECTORY API

User Role Creation from "User Management" Responsibility: Role Creation

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.

8)Link all activities with in process

Open Process window and join all the activities we created so far. To join one activity to other you need to first select the source activity , right click and drag a line to destination activity.

041711_1245_Workflowtut38

9)Save workflow to database

There are three different methods to upload a workflow into database. The simple one is from workflow builder tool itself.

Go to File > Save as and choose the option “database”.

Provide your apps user login credentials and click OK.

To understand how to save workflow from a file (.wft) to database and vice versa you can read the below article.

Workflow Migration

 

10)Launching workflow from PL/SQL:

 Make sure to run "Workflow background process" after item is created. 
Workflow will get into defered status initially and after workflow background process program is completed it should be in running mode.

Compile the PL/SQL code in database.
First create a database trigger as below to call a PL/SQL procedure from which you kick off the workflow.

–Create Database Trigger


–Create PL/SQL Package to kickoff workflow


 
Create Inventory Item
Go to Inventory module and create inventory item from master org form.


Run “Workflow Background Process” concurrent program
 
Go to System administrator responsibility and launch concurrent program “Workflow background process” and choose Yes to the parameter process deferred.

, ,