Overview:
Function Usage:- capture the business event data like Item Key, Event data,etc ., and insert into staging table
Parameter Usage:- p_subscription_guid => From WF ,p_event => Event id from WF
Function Usage:- capture the business event data like Item Key, Event data,etc ., and insert into staging table
Parameter Usage:- p_subscription_guid => From WF ,p_event => Event id from WF
Business Event is an occurrence of the business activity. Business events raise by oracle workflows or forms code or Pl/SQL code.
Next, need to create subscription. Subscription is an activity to be performed on occurrence of a business event.We can able to create more one subscriptions in the business event.
Below can through how to create business events following the steps
- Create a custom Business event
- Create a subscription to the event
- Raise the event from PL/SQL or workflow
- Consume the event in PL/SQL
Step 1:
Create a Business event
Navigate to Workflow Administrator Web Applications responsibility -> Business Events -> create Event
Define / create the Name , display name ,etc ., all mandatory fields
Step 2:
Next click -> create subscription
Enter the Mandatory fields and define Action type as “Custom” and system as “Connection Name”
Step 3:
Give the PL/SQL Rule function as “xx_demobe_subscribe” ( package name.function or function name). Then define as owner name & owner tag. Then click apply
Sample Script :
CREATE OR REPLACE FUNCTION APPS.xx_demobe_subscribe (
p_subscription_guid IN RAW,
p_event IN OUT NOCOPY WF_EVENT_T)
RETURN VARCHAR2
IS
l_errm VARCHAR2 (200);
BEGIN
INSERT INTO xx_temp_for_demo (msg)
VALUES (
'Event '
|| p_event.getEventName ()
|| ' . '
|| TO_CHAR (SYSDATE,'RRRRMMDD HH24:MI:SS')
|| ' . '
|| 'Event Key=>'
|| p_event.geteventkey ());
Return 'SUCCESS';
EXCEPTION
WHEN OTHERS
THEN
l_errm := SUBSTR (SQLERRM, 1, 1500);
INSERT INTO xx_temp_for_demo (msg)
VALUES (
p_event.geteventkey ()
|| ' . '
|| TO_CHAR (SYSDATE, 'RRRRMMDD HH24:MI:SS')
|| ' . ERROR:'
|| l_errm
|| ';');
RETURN 'ERROR';
END xx_demobe_subscribe;