Tuesday, July 12, 2022

Call Workflow from OAF Page

 We can call Workflow in 2 ways from the OAF

1) Using PL SQL Procedure, call procedure from OAF page using callable
statement.
CREATE OR REPLACE PROCEDURE start_wf_prc
IS
l_itemtype VARCHAR2 (30) := ‘XX_WF’;
l_itemkey VARCHAR2 (300) := 'xx';
BEGIN
wf_engine.createprocess (l_itemtype, l_itemkey,
‘XX_MAIN_PROCESS_WF’);
wf_engine.setitemowner (itemtype => l_itemtype,itemkey => l_itemkey,owner
=> '1');
wf_engine.startprocess (l_itemtype, l_itemkey);
COMMIT; END;

2) Write following function in Controller of the OAF page.
public void callCustomWorkFlow(OAPageContext pageContext)
{
String strWfItemType = “XX_WF”;
String strWfProcess =
“XX_MAIN_PROCESS_WF”;
String strWfItemKey = "xxitemkey";
OANavigation wfNavigation = new OANavigation(); // Create Workflow
Process
wfNavigation.createProcess(pageContext, strWfItemType, strWfProcess,
strWfItemKey);
wfNavigation.setItemOwner(pageContext,"xx"); // Start Workflow
Process
wfNavigation.startProcess(pageContext, strWfItemType, strWfProcess,
strWfItemKey);
}

No comments:

Post a Comment

SQL Query to Convert number into Words for Money

SELECT INITCAP ( DECODE ( FLOOR (TO_NUMBER ( :amount)), 0, '', TO_CHAR (TO_DATE...