Saturday, September 28, 2013

WebCenter: Ctrl+Shift+E to add BTF at runtime with default parameter values.

We all know that we can use Ctrl+Shift+e to add a task-flow on a page. Yes, page must have oracle-composure components on it. What if our task-flow accepts parameter? User (Admin), who is editing page can click on spanner icon and set task-flow parameters but there are times when parameter value needs to be calculated dynamically. For example if we have page on which left area is showing person names in tree. If end user selects a person, right area should show the details of that selected person.

Now assume you already have a task-flow which can show person details but it accepts a mandatory parameter personId. If admin adds this task-flow at runtime to right area, he can't pass value to task-flow as its dynamic. He needs to specify an expression, which he would not be knowing as developer only knows where exactly person-id of selected person is getting stored.

If left area is storing selected person-id in requestscope, we need to pass parameter as #{requestScope.pPersonId}. End user (Admin), who is editing page, can't remember this expression but developer can set this exression as default value, so that whenever admin adds it on a page, the default expression is set for this parameter.

To set default expression for this parameter, developer can follow these steps

1. Add task-flow (PersonDetailFlow) to resource catalog. This will allow admin to add task-flow at runtime.

2. While adding in resource catalog you can set URL parameter. Specify this expression #{requestScope.pPersonId} for person-id parameter.

Now when admin adds such task-flow on a page at runtime, by default an expression will be set for pPersonId parameter. Admin need not to do anything special to set value of this attribute.

Disclaimer: Any views or opinions presented in this blog are solely those of the author and do not necessarily represent those of the company.

No comments: