Friday, March 19, 2010

Passing Parameters from ADF Task Flow with Fragments into ADF Bounded Task Flow

It is a common use case to pass parameters from ADF Task Flow with fragments into another ADF Task Flow without fragments. I got this question for my previous blog post - Parent Action Activity in ADF Task Flow. The use case:

1. We have ADF Bounded Task Flow, it contains two main elements - page P1 and another ADF Task Flow call - C1
2. Page P1 included ADF region, this region comes from ADF Task Flow with Fragments
3. We need to pass parameter from ADF region available in P1 into ADF Task Flow call C1

How this can be achieved? If the bounded task flows referenced by ADF regions share the data control scope and the transaction - we can access parameter directly through Expression Language. If data control scope is not shared - probably you will need to use ADF Contextual Event Framework. Today I will describe first case, and will go through ADF Contextual Event Framework in my next posts.

Download sample application - ADFRegionNavigation2.zip. This sample is based on application from my blog post mentioned above and implements ADF Bounded Task Flow with input parameter:


I want to pass value from ADF region into this parameter. When the data control scope is shared, it is enough just to reference Attribute Value available in ADF region Page Definition:


Make sure you understood, why data prefix is used, instead of bindings as usual. It is because in this case, we are accessing Page Definition element directly from ADF Task Flow. You can construct Expression Language statement with Expression Builder wizard:


Thats it - parameter from ADF region will passed now to ADF Bounded Task Flow. If we select some country from table component available in ADF region:


And press Locations button - Parent Activity will be triggered and we will navigate into ADF Bounded Task Flow, where parameter value from ADF region will be successfully passed and displayed:

12 comments:

Oskar said...

Hi

We knew now, how pass parameters, but how we can catch return?

I have popup with dynamic region on my page. i also have to button, "button1" and "button2";
When i press "button1", i run my dynamic region with parameter #{bindings.field1.inputValue}
When i press "button2" i run the same dynamic region (the same taskflow) but with parameter #{bindings.field2.inputValue}
I do this using clientAttributes.

But now i want catch return parameter from this dynamic taskflow?


Thanks in advice
Oscar

Mario said...

Hi

I was not quite sure if this is the appropriate post to make this comment but it seems liked the most appropriate. I am trying to perform a like operation in the expression builder which compares the inputValue of a form field to a string. The goal is to find out whether the field value starts with the string which it being compared to. This is the statement i am inserting into the expression builder which is not working : #{bindings.Code.inputValue like "324"}

Regards
Mario

Rolls said...

Hi,

Great post. I am trying to do exactly what your blog is doing.

However, I would like to pass a value that is coming from an inputText on a region, to a page in a boundedTaskFlow.

You are passing the inputValue of an attribute of a collection.

Since they are sharing the data control, how can I define something on my region's pageDef, so that I can grab the value from the inputText?

Andrej Baranovskij said...

Hi,

If data control is shared, you can reference region page definition element, directly from parent bounded task flow.

Regards,
Andrejus

udayc88 said...

Hi Andrejus,

Thanks for the post! I was wondering if there is a way to pass values from the region to the called taskflow using memory scopes ? Such as values that are computed through some business logic, and can't be derived directly from the bindings.

Thanks in advance.
Uday

Andrej Baranovskij said...

It would work to pass through Session scope, but is not good practice.

If you want to add business logic, you can call your method getter and reference shared data control attribute inside that method.

Andrejus

rajeshk said...

i am doing the same thing...i am entering from TF1 to TF2 and the passing parameter works fine..but after that if i click the external navigation link to call TF2 then the default activity page is called but page shows the old value only..i debug the code i found the bean is newly instantiated but on page value is not updated.

Vinitha said...

Hi Andrejus,

This is really a great post.. When i tried implementing the same for a scenario as below i was unable to achieve the value passing b/w parameters.

Have countriesView and LocationView.
Used CountryTF that holds country.jsff and a button on the same named location that would navigate to Location.jsff.
Country.jsff holds the CountryView as Read only table similarly Location.jsff holds locationView as read only table.

Requirement is the location TF should display all the locations for selected Country.

As per your post, Created parameter in LocationTF as Name : "countryParam" value as "#{pageFlowScope.countryParam} with No Controller transaction and shared scope....

In CountryTF, selected LocationTF and provided value for the parameters as countryParam -> #{data.CountryPagedef.countryid.inputvalue } with No Controller transaction and shared scope....

Have no association and viewlinks for the VO and EO used. Still unable to get the list of locations associated with Country.

But the same is achieved in your post..can you kindly explain the same..

Please help me with your email id so that the sample on the same can be mailed across.

Regards,
Vinitha G

Anonymous said...

if the value of parameter being passed is changed in calling taskflow then the change in value is not reflected in the called task flow. Any solution to this problem..?

Andrej Baranovskij said...

This is how it is supposed to be. You need to set refresh=ifNeeded for the region binding in Page Def, it will reload region with new value of parameter.

Andrejus

Don Kleppinger said...

Instead of using #{data.longpagedefname to put task flow param into bindings you can add Page Parameters to copy the input parameters from pageFlowScope to the page bindings. Just select page on task flow, go to property inspector and select page Parameters tab.

Andrej Baranovskij said...

This is old post. I guess my point was to show how to access binding value from anywhere in Task Flow, when binding resides in shared scope.

Thanks for the additional hint !

Andrejus