Documente Academic
Documente Profesional
Documente Cultură
1 | 2 | 3| 4 | 5 | 6 | 7 Next>>
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.
Expand the node to see attributes, processes, notifications, functions, Events, Messages and lookup types.
Workflow Attributes
<<Previous 1 | 2 | 3| 4 | 5 | 6 | 7 Next>>
Type: Text
Type: Form
Value: INVIDITM
Workflow Function
<<Previous 1 | 2 | 3| 4 | 5 | 6 | 7 Next>>
Click Apply and then OK
Workflow Notification
<<Previous 1 | 2 | 3| 4 | 5 | 6 | 7 Next>>
Enter fields
Workflow Messages
<<Previous 1 | 2 | 3| 4 | 5 | 6 | 7 Next>>
Adhoc roles can be created through PL/SQL 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
DECLARE
BEGIN
wf_directory.CreateAdHocRole(lv_role,
lv_role_desc,
NULL,
NULL,
'MAILHTML',
NULL,
NULL,
'ACTIVE',
NULL);
End;
DECLARE
v_role_name varchar2(100);
v_user_name varchar2(100);
BEGIN
v_role_name := 'ERPSCHOOLS_DEMO_ROLE';
v_user_name := 'NAME3';
WF_DIRECTORY.AddUsersToAdHocRole(v_role_name, v_user_name);
END;
DECLARE
v_role_name varchar2(100);
v_user_name varchar2(100);
BEGIN
v_role_name := 'ERPSCHOOLS_DEMO_ROLE';
v_user_name := 'NAME3';
END;
Open the notification properties and then navigate to node tab, select performer as the role you just
created and loaded from database.
Tables:
WF_ROLES
WF_USER_ROLES
WF_LOCAL_ROLES
WF_USER_ROLE_ASSIGNMENTS
Launching workflow from PL/SQL
<<Previous 1 | 2 | 3 | 4 | 5 | 6 | 7
First Create a database tirgger as below to call a PL/SQL procedure from which you kick off the workflow.
Database Trigger
DECLARE
lv_itemkey VARCHAR2(10);
error_msg VARCHAR2(2000);
error_code NUMBER;
BEGIN
lv_user_id := fnd_global.user_id;
lv_orgid := fnd_global.org_id;
ERP_DEMO.LAUNCH_WORKFLOW('ERP_DEMO'
,lv_itemkey
,lv_id
,lv_orgid
,lv_item_segment1
);
EXCEPTION
WHEN OTHERS THEN
error_code := SQLCODE;
RAISE_APPLICATION_ERROR(-20150,error_msg);
END;
PROCEDURE LAUNCH_WORKFLOW
(
);
END ERP_DEMO;
PROCEDURE LAUNCH_WORKFLOW(
)
IS
v_master_form_link varchar2(5000);
BEGIN
--set the attribute values in workflow so that you can use them in notifications
END LAUNCH_WORKFLOW;
-- This procedure will just put the item number into workflow attribute ERP_ITEM_NUMBER
PROCEDURE GET_ITEM_DETAILS(
)
IS
v_GET_ITEM_NUMBER VARCHAR2(1000);
BEGIN
--v_GET_ITEM_NUMBER := wf_engine.getitemattrtext(
resultout:='COMPLETE:'||'Y';
dbms_output.put_line('Entered Exception');
fnd_file.put_line(fnd_file.log,'Entered Exception');
END GET_ITEM_DETAILS;
END ERP_DEMO;
/
Launching workflow from PL/SQL
<<Previous 1 | 2 | 3 | 4 | 5 | 6 | 7
First Create a database tirgger as below to call a PL/SQL procedure from which you kick off the workflow.
Database Trigger
DECLARE
lv_itemkey VARCHAR2(10);
error_msg VARCHAR2(2000);
error_code NUMBER;
BEGIN
lv_user_id := fnd_global.user_id;
lv_orgid := fnd_global.org_id;
ERP_DEMO.LAUNCH_WORKFLOW('ERP_DEMO'
,lv_itemkey
,lv_id
,lv_orgid
,lv_item_segment1
);
EXCEPTION
WHEN OTHERS THEN
error_code := SQLCODE;
RAISE_APPLICATION_ERROR(-20150,error_msg);
END;
PROCEDURE LAUNCH_WORKFLOW
(
);
END ERP_DEMO;
PROCEDURE LAUNCH_WORKFLOW(
)
IS
v_master_form_link varchar2(5000);
BEGIN
--set the attribute values in workflow so that you can use them in notifications
END LAUNCH_WORKFLOW;
-- This procedure will just put the item number into workflow attribute ERP_ITEM_NUMBER
PROCEDURE GET_ITEM_DETAILS(
)
IS
v_GET_ITEM_NUMBER VARCHAR2(1000);
BEGIN
--v_GET_ITEM_NUMBER := wf_engine.getitemattrtext(
resultout:='COMPLETE:'||'Y';
dbms_output.put_line('Entered Exception');
fnd_file.put_line(fnd_file.log,'Entered Exception');
END GET_ITEM_DETAILS;
END ERP_DEMO;
/