Creating Descriptive Flex Field (DFF) Bean in OAF
- by Manoj Madhusoodanan
In this blog I will explain how to add a custom DFF in a custom OAF page.I am using XXCUST_DFF_DEMO table to store the DFF values.Also I am using custom DFF named XXCUST_PERSON_DFF.
Following steps needs to be performed to create this solution.
1) Register the custom table in Oracle Application2) Register the DFF3) Define the segments of DFF4) Create BC4J components for OAF and OA Page which holds the DFF
I will explain the steps in detail below.
Register the custom table in Oracle Application
I am using custom DFF here so I have to register the custom table which I am going to capture the values.Please click here to see the table script.
I am using the AD_DD package to register the custom table.Please click here to see the table registration script.
Please verify the table has registered successfully.
Navigation: Application Developer > Application > Database > Table
Table has registered successfully.
Register the DFF
Next step is to register the DFF. Navigate to Application Developer > Flex Field > Descriptive > Register.
Give details as below.
Click on Reference Fields and set the Reference Field as ATTRIBUTE_CATEGORY.
Click on the Columns button to verify that the columns ATTRIBUTE_CATEGORY,ATTRIBUTE1 .... ATTRIBUTE30 are enabled.
DFF has registered successfully.
Define the segments of DFF
Here I am going to define the segments of the DFF.Navigate to Application Developer > Flex Field > Descriptive > Segments.Query for "XXCUST - Person DFF". Uncheck "Freeze Flexfield Definition".
In my DFF the reference field I want to display a value set which has values "Permanent" and "Contractor". So define a value set XXCUST_EMPLOYMENT_TYPE.
Navigation: Application Developer > Flex Field > Descriptive > Validation > Sets
After that assign the values to above created value sets.
Navigation: Application Developer > Flex Field > Descriptive > Validation > Values
Assign XXCUST_EMPLOYMENT_TYPE to Context Field Valueset.
Setup the Context Field Values based on below table.
Context Code
Segments
Global Data Elements
Phone Number
Email
Fax
Contractor
Manager Extension Number
CSP Name
Permanent
Extension Number
Access Card Number
Phone Number,Email and Fax displays always.When user choose Context Value as "Contractor" Manager Extension Number and CSP Name will show.In case of "Permanent" Extension Number and Access Card Number will show.
Assign value set also as follows.
For Global Data Elements following are the segments.
For "Contractor" following are the segments.
For "Permanent" following are the segments.
Check the "Freeze Flexfield Definition" check box and save.Standard concurrent program "Flexfield View Generator" will generate XXCUST_DFF_DEMO_DFV view which we mentioned in the DFF registration step.
Now the DFF has created successfully and ready to use.
Create BC4J components for OAF and OA Page which holds the DFF
Create the BC4J components ( EO,VO and AM) appropriately.Create the page based on the created VO.For DFF create an item of type "flex" with following property.
Note: You cannot create a flex item directly under a messageComponentLayout region, but you can create a messageLayout region under the messageComponentLayout region and add the flex item under the messageLayout region.
In the Segment List property give the segment names which you want to display.The syntax of this is
Global Data Elements|SEGMENT 1|...|SEGMENT N||[Context Code1]|SEGMENT 1|...|SEGMENT N||[Context Code2]|SEGMENT 1|...|SEGMENT N||...
Eg: Global Data Elements|Phone Number|Email|Fax||Contractor|Manager Extension Number|CSP Name||Permanent|Extension Number|Access Card Number
When you change the Context Value corresponding segments will display automatically by PPR in the page.
You can attach partial action to the DFF bean programmatically so that you can identify the action related to DFF.
pageContext.getParameter(EVENT_PARAM) will return "FLEX_CONTEXT_CHANGEDPersonDFF" when you change the DFF Context.
Page is ready and you can test.
When you choose "Contract" following output you can see.
When you choose "Permanent" following output you can see.
Give proper values and press Apply.You can see values populated in the table.