Monday, April 13, 2015

Oracle BPM: Override Oracle BPM Operations (Approve, Reject, ....)

When you create new Oracle BPM Application and generate human task page with payload,  BPM automatically will generate human task operations like Approve, Reject, OK, ....



  Sometime developer need to execute some code before calling operation Approve or Reject so you need to override operation Approve or Reject. To do so follow these steps:

1- Bind approve button action to method in backbean

<af:commandToolbarButton actionListener="#{invokeActionBean.setOperation}"
text="#{wf:getResourceValue('APPROVE', 'bindings.customActions')}"
disabled="#{!bindings.APPROVE.enabled}"
partialSubmit="false"
visible="#{wf:isCustomActionAvailable('APPROVE', 'bindings.customActions')}"
id="ctb1"
action="#{myBean.approveAction}">
<f:attribute name="DC_OPERATION_BINDING" value="bindings.APPROVE"/>
</af:commandToolbarButton>
view raw approve.xml hosted with ❤ by GitHub


2- In the approval action back bean method write this:

public String approveAction()
{
try
{
// write code here before execute approval action
Map map = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
oracle.bpel.services.workflow.worklist.adf.InvokeActionBean invokeActionBean = (oracle.bpel.services.workflow.worklist.adf.InvokeActionBean) map.get("invokeActionBean");
String result = invokeActionBean.invokeOperation();
// write code here after execute approval action
return result;
}
catch (Exception e)
{
// TODO: Add catch code
e.printStackTrace();
}
return null;
}
view raw approve.java hosted with ❤ by GitHub



be sure that the button in the page has actionListener="#{invokeActionBean.setOperation}" and has  attribute




You can do same steps in any other operations like Reject, Ok, ....

3 comments:

  1. I was just searching for this! I will try it! Tanks!!!

    ReplyDelete
  2. "Great blog created by you. I read your blog, its best and useful information. You have done a great work. Super blogging and keep it up.php jobs in hyderabad.
    "

    ReplyDelete