Tuesday, 9 June 2015

Steps to get all the parameter of a Business Event



1. Create a temp table MY_LOG_TABLE using below script, this will store parameters information.
2. Compile the below package TEST_BUSINESSEVENT.
3. Create a subscription of that business event using function TEST_BUSINESSEVENT.UPDATE_ASGN.
4. Perform the steps to fire the business event.
5. Check the table MY_LOG_TABLE for the parameters detail.

Table Script: 
create table my_log_table (PARAMETERS VARCHAR2(100));

Package:
create or replace package TEST_BUSINESSEVENT
AS
procedure log_me (t varchar2);
function update_asgn (p_subscription_guid in raw,
                      p_event in out WF_EVENT_T) return varchar2;
END;
/
create or replace package body TEST_BUSINESSEVENT
AS
procedure log_me (t varchar2) IS pragma autonomous_transaction;
begin
  insert into my_log_table values(t);
  commit;

end;

function update_asgn (p_subscription_guid in raw,
                      p_event in out WF_EVENT_T) return varchar2 is
                     
    l_wf_parameter_list_t wf_parameter_list_t;
    i number := 1;
    c number;
    l_key varchar2(30);
    l_val varchar2(2000);
begin
  l_wf_parameter_list_t := p_event.getParameterList();
  c := l_wf_parameter_list_t.count();
 
  log_me('event = ' || p_event.getEventName());
  log_me('count : ' || c);
 
  while (i<=c)
  loop
   
    l_key := l_wf_parameter_list_t(i).getName();
    l_val := l_wf_parameter_list_t(i).getValue();
   
    log_me(l_key || '=' || l_val);
   
    i := i + 1;
  end loop;
 
  return 'SUCCESS';
  exception
    when others then
      log_me('errm' || sqlerrm);
end;
end;

No comments:

Post a Comment