Business Events Oracle, step by step guide.
Described below is a sample of setting up Business Events in Oracle Applications ( 11.5.10) onwards.
The first step to setting up business events is to making sure you have the right responsibilities. You will have to request the system administrator to provide you "Work Flow Administrator" responsibility.
Work Flow Administrator –> Business Events –> Search
Search for the events you want to attach custom logic to. In this example, the event used is
oracle.apps.jtf.cac.task.createTask
Each time a new task gets created the events will get triggered. Attach the custom pl/sql function that you want to fire associated with this event.
Now the next step is defining the custom function handling the logic. The standard signature of all subscription functions is
myfunc(p_guid in RAW, p_event in ou noCopy WF_EVENT_T) return varchar2.
You can get the values passed by the event using GeValueForParameter();
CREATE OR REPLACE PACKAGE BODY APPS.test_BE_Pkg IS
FUNCTION my_test_task_business_event(p_subscrition_guid IN RAW,
p_event IN OUT NOCOPY WF_EVENT_T )RETURN VARCHAR2 IS
l_task_id NUMBER;
l_task_status VARCHAR2(30);
l_task_num VARCHAR2(30);
l_event_name VARCHAR2(240) := p_event.getEventName();
BEGIN
l_task_id := p_event.GetValueForParameter(‘TASK_ID’);
INSERT INTO my_temp VALUES ( l_task_id ,l_task_id);
COMMIT;
SELECT sts.NAME,
a.task_number
INTO l_task_status ,
l_task_num
FROM jtf_task_statuses_vl sts,
jtf_tasks_b a
WHERE a.task_id = l_task_id
AND a.task_status_id = sts.task_status_id;
INSERT INTO my_temp VALUES(l_task_num,l_task_status);
RETURN ‘SUCCESS’;
COMMIT;
END my_test_task_business_event;
END test_BE_Pkg;
/