Sunday, May 17, 2009

Parent Action Activity in ADF Task Flow

Recently I have faced a problem, when was trying to navigate to ADF Task Flow Call activity. The problem was, that I was initiating navigation from inside the region and navigation flow was defined not in bounded region ADF Task Flow, but inside parent bounded page ADF Task Flow. This means, navigation outcome from parent ADF Task Flow was simply invisible for button I have created inside region. But as usual in most of the cases, ADF provides very elegant solution to solve problem of external navigation from inside the region. I will describe it in this post.

The problem is, that I have bounded ADF Task Flow, however main page is using region and this region can't see declared navigations from this ADF Task Flow:


Region is used on main page, this region provides table of Countries, user can select any country and navigate to Location ADF Task Flow:


And here is the answer for described problem - in order to navigate from region using navigation rule from parent ADF Task Flow, you can use Parent Action activity inside region ADF Task Flow:


Only one thing you need to do is to define parent-outcome property, or in other words - navigation outcome from parent ADF Task Flow you want to use. In my case it is child navigation outcome:


Defined parent outcome will navigate to ADF Task Flow call activity and will open locations page.

On runtime, when user will press Location button implemented in region component, navigation from parent ADF Task Flow will be triggered:


Correct list of locations is returned:


You can download sample application for this post - ADFRegionNavigation.zip.

Useful hint, when user will return to Countries table, in order to show previously selected record, set DisplayRow = selected for af:table component:

22 comments:

Anonymous said...

Hi,

Thanks for this example. In your example, you do not need to pass any parameters from the region taskflow to the child task flow (i.e from Countries region to the locations as there is a view link between countries and locations VO). How do we achieve the same if Locations TF requires the selected countryID as the parameter?

Thanks

Andrej Baranovskij said...

Hi,

Here is the asnwer: http://andrejusb.blogspot.com/2010/03/passing-parameters-from-adf-task-flow.html

Andrejus

Unknown said...

Hi ,
In my case I have alogin page in undounded task flow which calls dounded task flow.
My bounded task flow uses dynamic tab shell.And if login is successfull user will be directed to welcome page where default welcome tab shell is open.
When i run my application i m receving tabConetxt null pointer excetion.
As per my knowledeg i know how to pass tab context reference from 1 task flow to other.But not sure how should i pass tab context from Login View activity to welcom taskflow

Andrej Baranovskij said...

It might be, you need to install UI Shell update - http://andrejusb.blogspot.com/2010/04/oracle-ui-shell-update-available-102.html

Regards,
Andrejus

Anonymous said...

Hi,

Is there a way to customize the train stop icons, to display my own icons on each stop...

please point me there...

Anand C said...

The example provided does not work with j developer version :

Studio Edition Version 11.1.1.4.0
Build JDEVADF_11.1.1.4.0_GENERIC_101227.1736.5923

Kindly provide an example to check the use case for the ParentAction of the taskflow.

Andrej Baranovskij said...

It works for me with 11.1.1.4.0

What error you are getting?

Andrejus

Anand C said...

on selecting a country and clicking locations.. no action is performed.

Sir my basic requirement is -- there is a parent taskflow and an embeded child taskflow in it. I have initializer/method call activity method for both, After parent initializer is executed, it come to the child initiaizer.

How will I get to know the parent taskflow id, from the child method call activity ?


Usual way to fetch the taskflow id is :ControllerContext.getInstance().getCurrentViewPort().getTaskFlowContext().getTaskFlowId();

Andrej Baranovskij said...

Sample works fine - I have tested once again.

Andrejus

Anonymous said...

Hi,
I am new to Jdeveloper,
I have a 3 tables department, courses, sections
as you know each department suggest many courses and each course have one or more sections.
I want to implement an application that contains a page that contains all the departments the department number is surrounded by a link component when I click on it It will direct to a page that allow me to update this department information and view all the courses of the department and courses numbers in that page are surrounded by links also and navigates to a page that allow me to update courses and view sections for the selected course
how can I implement this using task flow for each part department-course, course-section, or I must implement these in one task flow?

Ankit said...

I want to call a bounded task flow that contains fragments from unbounded task flow that contains pages in adf.

I have a pop up in main page and want to call a fragment of other bounded task flow on button click.

Unknown said...

Hi,

How can I return to a view after a Task Flow Return Activity?

For example:
"After commit, the user is redirected to another view activity..." But I can`t put a Control Flow Case from a Return to a view...

I'm waiting to hear from you Andrejus.
Thanks, Take Care!

Regards.

Andrej Baranovskij said...

User will be returned to the call Task Flow. In calling Task Flow you can redirect to another view activity.

Andrejus

Unknown said...

Great! It works!

Looks it like a "sub-"task-flow? Or this nomenclature doesn't exists?


After my application is 100% working, I've to build another one to communicate with it. Could you recommend a way to do that communication? When I "portletize" my task flow, can I communicate my 2 applications like "Portlets"?

Sorry for the simple questions, (I've many others), but I'm newbie in ADF Task Flow trying to improve my knowledge on it.

Thank you! =)

Anonymous said...

Thanks Andrejus for your helpful post as always!!!!

Unknown said...

Hello Andrejus,

I am inside a BTF and navigate to another BTF from the parent (via parentAction).
How can I set parameters to the child TF ?

If i set the param. on pageFlowScope it's empty in the destination TF because it's navigating through the parent (parentAction).

I want to avoid using sessionScope.

Thanks

Andrej Baranovskij said...

You need to pass the value through Task Flow parameters, copy it into Page Flow Scope of target task flow.

Regards,
Andrejus

spidercatte said...

Hello,

Does this work with return activity in the parent taskflow? So basically I used contextual event to redisplay my parent TF from a region (within the same parent main page). The in my region/child TF, I have a return activity that refers to the retun activity of the parent TF. However for the contextual event that I mentioned, return activty does not redisplay the parent TF from previous data/display.

Thanks,

Cathy

Unknown said...

Hi Andrejus,

In regards to your previous comment from 14 May.
The problem is not with params passed to a child TF using TF Params, my problem is with sending the parameters from the child TF to the parent (so that I can send them afterwards to the other TF).

I use a parentAction from a child TF and wish to pass parameters from the child TF to the parent so that I can pass them to another TF from the parent.

I have an alternative method using a referenced ManagedBean that i set on the child TF as a parameter referenced from the parent TF. I then call from the child TF (using the ManagedBean set as a param to the TF) a method from the ManagedBean to pass a map of params. This references the instance of the ManagedBean from the parent TF and allows me to send params.

I just wish it were simpler to pass parameters from a child TF to to a parent TF using parentAction...

Anonymous said...

Hi Andrejus,

I have problem with similar situation.

Return to calling task flow is performed using parent action activity.
That activity needs to call commit task flow activity on calling task flow.

Commit is performed correctly but this error is raised during refresh:

<[3755] DCUtil, RETURNING: for pageFlowScope.listDoc.dynamicTaskFlowId>

<>
oracle.adf.controller.ControllerException: ADFC-06003: TaskFlowId for a child view port must be specified.
at oracle.adf.controller.internal.binding.RegionUtils.getTaskFlowId(RegionUtils.java:596)
at oracle.adf.controller.internal.binding.TaskFlowRegionModelLocal.getTaskFlowId(TaskFlowRegionModelLocal.java:28)
at oracle.adf.controller.internal.binding.DCTaskFlowBinding.getTaskFlowId(DCTaskFlowBinding.java:689)
at oracle.adf.controller.internal.binding.DCTaskFlowBinding.shouldRefreshRegion(DCTaskFlowBinding.java:723)
...



Any clue?

Best regards
Marjan

Unknown said...

Hi Marjan,

Just as an idea, keep in mind that when you navigate "upwards" in the taskflow structure, you may find yourself with different instances of the beans if they have less than or equal scope to pageFlow.
By the looks of it you are trying do display a Taskflow but lack the TFId. The Id comes from a bean which may have a different instance than the one you're expecting.

You can:
1 - put the scope higher - sessionScope maybe ? (Although not recommended, you could do it as a test)
2 - hold the value (the tfId) somewhere else or pass the value as parameter to the calling Taskflow.

I would go for the latter - you should use taskflow parameters as much as possible.

Cheers,
Andrei

Mamatha said...

Hi Andrejus,

I have a taskflow from which i'm calling another taskflow as an inline-popup and if i click on a commandbutton in that popup i should return back to the parent taskflow. I am able to open the taskflow in popup. I'm unable to come back from the taskflow eventhough i used parent activity wit an outcome.
Could you please help me?

Regards
Mani