Tuesday, June 18, 2013

Raising Business Event Using API WF_EVENT


API WF_EVENT.Raise()


API Description: Parameters:

Parameter Name
Type(In/Out)
Data Type



p_event_name
IN
VARCHAR2
p_event_key
IN
VARCHAR2
p_event_data
IN
CLOB
p_parameter_list
IN OUT NOCOPY
wf_parameter_list_t
p_send_date
IN
DATE
 
 API Description: Parameter Sources

Parameter Name
Source(Tablename.column / Query)


p_event_name
Name of the business event
p_event_key
Event_name. okl_wf_item_s.NEXTVAL
p_parameter_list
wf_parameter_list_t
  

Sample Script:

declare
   ---- custom variables
   l_eventdata         varchar2(1000) := 'Business Event Test';
   l_parameter_list    wf_parameter_list_t := wf_parameter_list_t();
   l_org_id            number;
   l_req_num           varchar2(100);
   
begin
  
   -- Adding event parameters (You can use these in Event subscribed Fucntion)
   wf_event.addparametertolist('USER_ID', fnd_profile.value('USER_ID'), v_parameter_list); 
   wf_event.addparametertolist('RESP_ID', fnd_profile.value('RESP_ID'), v_parameter_list); 
   wf_event.addparametertolist('RESP_APPL_ID', fnd_profile.value('RESP_APPL_ID'), v_parameter_list);             
            
   wf_event.raise( 
                  p_event_name    => 'oracle.apps.xxpo.test_busi_event'
                 ,p_event_key     => x_distribution_id
                 ,p_event_data    => v_eventdata
                 ,p_parameters    => v_parameter_list
                 ,p_send_date     => trunc(sysdate)
                 );
end;

 In wf_deferred table there should one row for this business event.(If Phase value is more than 99 - See Event subscription)
 
select *
from wf_deferred
where corrid like '%<business event name>%';

No comments:

Post a Comment