Search This Blog

Showing posts with label Dynamically refresh ADF task flow. Show all posts
Showing posts with label Dynamically refresh ADF task flow. Show all posts

Wednesday, September 19, 2012

ADF Taskflow programatic refresh

Refreshing a taskflow sometimes becomes very essential in scenarios where we have multiple pages/fragments in a task flow and the business process requires multiple taskflows and each taskflows are interconnected.

For example :

Taskflow 1 has Pagefragment1, Pageframent2, Pagefragment3 and are executed in the same sequence based on your busines scenario.

Taskflow 2 has Pagefragment3, Pageframent4, Pagefragment5

Now on completion of Taskflow 1 (i.e Pagefragment 3), we call taskflow 2 and for any reason based on business logic we have to  go back to taskflow1. Surprisingly, taskflow1 starts at Pageframent 3 and NOT at Pageframent1, even though we set the default task for Taskflow1 as Pageframent1.

In such a scenario, we need to refresh the task flow that we instead to call by getting handler to the taskflow binding and refresh the taskflow. Refresh of taskflow re-renders/re-executes the taskflow starting from the default selection in the task flow. Below is the code snippet to do the same.

DCTaskFlowBinding tf = (DCTaskFlowBinding) JSFUtils.resolveExpression("#{binding.mytaskflow}");

//Refresh taskflow

tf.getRegionModel().refreshh(FacesContext.getCurrentinstance());