ADF: Default value when editing a row
Recently one of our customers had a need to assign a default value to a field only when editing a row. This tip show you how to achieve this behavior.
Let’s assume we have a simple task flow, as shown below:
In the first fragment we have an af:table based on Employees table in hr schema.
And in the second fragment we have a form based on the same view where we can edit selected row.
The goal is to set a different value to Email attribute when we navigate to the form. To achieve it we have to generate View Row Class in EmployeesVO.
In EmployeesVO inside ‘Java’ tab we have to click on ‘Java Classes’ edit pencil and check ‘Generate View Row Class EmployeesViewRowImpl’
as we want to add that field to the taskflow we need to have it published by editing Client Row Interface.
Now we can drag our method from datacontrols palette and drop it in the taskflow.
If we run again the app, select a row and click on edit button, once the form fragments appears we can see that Email field value has changed.