Thursday, August 20, 2015

ADF : Refresh the parent view when a taskflow displayed in a popup returns


- Refreshing the parent view when an in-line popup taskflow returns.

This scenario usually arises when the second task flow updates tables used by the first one from a different transaction context. 

There are two taskflows, both work with separate transaction contexts(Transaction attribute is set as new-transaction). Second taskflow is invoked from the first one as a dialog. The requirement here is to refresh the 'executables' of calling page(from first taskflow) when the second taskflow returns. 



createWO view from first task flow.

truckCompTF is the second taskflow.


- Define a returnListener for secondary window on the command button (which invokes second taskflow as dialog)

- Create method as dialogReturnListener in returnListner and copy below code

    public void dialogReturnListener(ReturnEvent returnEvent) {
        BindingContext bc = BindingContext.getCurrent();
          DCBindingContainer dcb =
            (DCBindingContainer)bc.getCurrentBindingsEntry();
          DCIteratorBinding iter =
            dcb.findIteratorBinding("TransportUnitVOIterator");   //your VOIterator 
          iter.executeQuery();         // It refresh the underlying IteratorBindings used by the parent page. 
       RequestContext.getCurrentInstance().addPartialTarget(returnEvent.getComponent().getParent().getParent());

    }


3 comments:

  1. Hello,

    How can I achieve this functionality when calling task flow but without popup?

    Thanks

    ReplyDelete
    Replies
    1. Yes, you can achieve this with task flow calling.
      Add return activity in your child task flow, set the outcome attribute.
      Add same outcome in parent task flow which will pointing to a method call.
      In method call add your logic to refresh iterator.

      Hope this will help you..

      Delete
    2. I do not understand your explanation. Please explain again.

      I understand this "Add return activity in your child task flow, set the outcome attribute."


      I do not understand this

      " Add same outcome in parent task flow "

      How can I do this ?

      Delete