Wednesday, 16 December 2015

How to Launch Workflow from PL/SQL?

declare
   v_itemtype   VARCHAR2(50);
   v_itemkey    VARCHAR2(50);
   v_process    VARCHAR2(50);
   v_userkey    VARCHAR2(50);
begin

v_itemtype := 'DEMOIT';
v_itemkey := '1233';
v_userkey := '1233';
v_process := 'DEMOPROCESS';
WF_ENGINE.Threshold := -1;
WF_ENGINE.CREATEPROCESS(v_itemtype, v_itemkey, v_process);

wf_engine.setitemuserkey(v_itemtype, v_itemkey, v_userkey );
wf_engine.setitemowner (v_itemtype, v_itemkey,'SYSADMIN');

WF_ENGINE.STARTPROCESS(v_itemtype, v_itemkey);
commit;
exception when others
then
  dbms_output.put_line(SQLERRM);
end;

workflow execution From Pl/SQL:

declare
 resultout varchar2(10);
 begin
  -- Call the procedure
  xxpo_di_approval_wf_pkg_new.next_approver(itemtype => 'XXPODI_1',
                                                                               itemkey => 9760,
                                                                                actid => 2,
                                                                                funcmode => 'RUN',
                                                                                resultout => resultout);
dbms_output.put_line(resultout);

end;

How to get attribute value after execution workflow?

select WF_ENGINE.GETITEMATTRTEXT(ITEMTYPE => 'XXPODI_1',
                                               ITEMKEY  => 9760,
                                               ANAME    => 'ATR_LEVEL1') from dual

3 comments: