Using class oracle.apps.fnd.framework.webui.OANavigation provided by Oracle for Workflow API, you can launch workflow directly from OAF Page. There are two ways to launch workflow :
1. Oracle PL/SQL API (wf_engine)
2. Java Wrappers
we shall launch a workflow from OAF page.
1. Create a submit button and name the partial event as "launchWF"
2. Write below java procedure to invoke workflow
import oracle.apps.fnd.framework.webui.OANavigation;
public void launchWF(OAPageContext pageContext)
{
String PItemType = "XXTEST";
String PProcess = "XXTEST_PROCESS";
String PItemKey = "SEQUENCE VALUE"; // This can be a random item key generated
OANavigation wf = new OANavigation();
// Now create Workflow Process
wf.createProcess(pageContext, PItemType, PProcess, PItemKey);
// Set Employee number
wf.setItemAttrText(pageContext, PItemType, PItemKey,"EMPLOYEE_ID", "101");
// Start Workflow Process
wf.startProcess(pageContext, PItemType, PProcess, PItemKey);
}
3. Call the above procedure in ProcessFormRequest Method
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
if ("launchWF".equals(pageContext.getParameter(EVENT_PARAM)))
{
launchWF(pageContext);
}
}
1. Oracle PL/SQL API (wf_engine)
2. Java Wrappers
we shall launch a workflow from OAF page.
1. Create a submit button and name the partial event as "launchWF"
2. Write below java procedure to invoke workflow
import oracle.apps.fnd.framework.webui.OANavigation;
public void launchWF(OAPageContext pageContext)
{
String PItemType = "XXTEST";
String PProcess = "XXTEST_PROCESS";
String PItemKey = "SEQUENCE VALUE"; // This can be a random item key generated
OANavigation wf = new OANavigation();
// Now create Workflow Process
wf.createProcess(pageContext, PItemType, PProcess, PItemKey);
// Set Employee number
wf.setItemAttrText(pageContext, PItemType, PItemKey,"EMPLOYEE_ID", "101");
// Start Workflow Process
wf.startProcess(pageContext, PItemType, PProcess, PItemKey);
}
3. Call the above procedure in ProcessFormRequest Method
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
if ("launchWF".equals(pageContext.getParameter(EVENT_PARAM)))
{
launchWF(pageContext);
}
}
No comments:
Post a Comment