Wednesday, 17 September 2014

TaskFlow Return Value example (communication between two task flows)

One of the interesting patterns regarding communication between task flows are return value parameters. It is possible to expose more than one return parameter. Also it is possible not to use them at all. OK, prerequisites are two task flows, one will be named innerTaskFlow and the second one outerTaskFlow. First one should contain two activities, one will be the view and the second will call an action in the parent (outer) task flow.

It should also define an output parameter. For example purposes I've defined it as a String. EL expression  in the Value column points to the attribute's value.

The page itself is as plain as it could be. I've decided to put the value directly (and implicitly) into pageFlowScope memory.

As for outerTaskFlow, it consumes innerTaskFlow as default activity. In its Property Inspector I've defined what needs to be done with innerTaskFlow output attribute - put it into current pageFlowScope.

The page is just to proof that value is properly consumed there. I've defined also back flow to allow you check it few times :)

Please create also test JSPX page to run and verify the example (drag and drop outerTaskFlow on it).

The question you may have is "why do I need to assign the pageFlowScope.varName1 to pageFlowScope.varName2 instead of using pageFlowScope.varName1 in both task flows?". To answer that please review (once again, I suppose :)) ADF memory scopes.


The pageFlowScope from innerTaskFlow is something different than pageFlowScope in outerTaskFlow. There is another way to interact between two task flows - bean injection. More or less you could pass outerTaskFlow pageFlowScope as an input parameter to innerTaskFlow:

And after that in the innerTaskFlow view activity call #{pageFlowScope.parent.retVal}. But about bean injections I'll talk about in the future :)

No comments:

Post a Comment