Using custom managed beans conditionally displaying OIM UDF fields

In this post, we are going to walk through creating a custom managed beans to conditionally display OIM form field.

The OIM UI customization use case:
Create a disconnected application instance – MainframeAccess in /sysadm, the MainframeAccessform will be created by default. Add 2 UDFs to the custom request form:

  1. lookup field: RequestDataAccessTool, with values: ‘test1’,’test2’ and  ‘Other (Please List)’
  2. input text field: Other

The UDF field: ‘Other’ will be displayed only when the value of ’Other (Please List)’ was selected from dropdown box RequestDataAccessTool.

Steps to create custom managed beans to show ‘Other’ field conditionally:

1. Create sandbox: MainframeDB2. Create App Instance- MainframeAccess, add UDF fields: RequestDataAccessTool and Other

2. Setup JDeveloper env and create JDeveloper projects – UICustomizations. (click here)

3. Create managed Bean:

The managed Bean contains key methods:

// attribute names
private static final String ACCESS_TOOL = “RequestDataAccessTool__c”;
// component bindings
private UIComponent rootPanelPGL;
private UIComponent requestDataAccessTool;
//a generic value change listener and handles value change events of all customized        components.
public void valueChangeListener(ValueChangeEvent valueChangeEvent) {
if (valueChangeEvent.getSource().equals(requestDataAccessTool)) {
FacesUtils.setAttributeBindingValue(ACCESS_TOOL, valueChangeEvent.getNewValue());
// return true if value of “RequestDataAccessTool__c” binding attribute equals to “Other”
public boolean isOtherAccessToolSelected() {
return “Other(Please List)”.equals(FacesUtils.getListBindingValue(ACCESS_TOOL, String.class));

4. Registered in ADF configuration to make the managed bean visible to the UI framework. Update adfc-config.xml file in JDeveloper project, under UICustomizations ->Web Content -> WEB-INF.
Under Overview tab, click Managed Beans and add a new entry:
Name: mainframeformbean
Class: oracle.iam.ui.customform.view.MainframeAccessRequestBean
Scope: backingBean

5. Compile and Deploy the project.

6. Download oracle.iam.ui.custom-dev-starter-pack.war file from OIM server. Extract it and create a new folder with name as ‘lib’ under the WEB-INF folder, if it not already exist. Copy the generated JAR file from step5 to the lib folder.

7. Re-package the WAR file. Overwrite the existing oracle.iam.ui.custom-dev-starter-pack.war file with the new WAR.

8. Restart the OIM Server.

9. Login to OIM /identity, active the sandbox that for creating application instance in step1, sandbox: MainframeDB2

10. Click on catalog link and search for MainframeAccess, add the app instance into cart and checkout

11. Click on Customize link from top of the page and select Source from view dropdown

12. Click on Details section, from source code, right click on “showDetailHeader: Details”

13. Update binding  with:  #{backingBeanScope.mainframeformbean.rootPanelPGL}

14. In Short Desc field, enter: Root Panel Group Layout

15. Apply and OK

16. Close Customize

17. Deactivate ALL sandbox and Export Sandbox MainframeDB2 into a temp folder: C:temp and unzip it.

18. Update .jsff files located :  C:tempsandbox_MainframeDB2oracleiamuiruntimeformviewpagesmdssyscustsitesite

19. For each .jsff file, find RequestDataAccessTool dropdown field, update < af:selectOneChoice > tag by adding:
helpTopicId=”RequestDataAccessTool” binding=”#{backingBeanScope.mainframeformbean.requestDataAccessTool}” valueChangeListener=”#{backingBeanScope.mainframeformbean.valueChangeListener}”

20. For each .jsff file, find ‘Other’ text box field and add
helpTopicId=”Other” rendered=”#{backingBeanScope.mainframeformbean.otherAccessToolSelected}”
into <af:inputText> tag.

21. Copy following section from  MainframeAccessCreateForm.jsff file and paste into MainframeAccessModifyForm.jsff and MainframeAccessBulkForm.jsff
<mds:modify element=”sdh4″>
<mds:attribute name=”binding” value=”#{backingBeanScope.mainframeformbean.rootPanelPGL}”/>
<mds:attribute name=”shortDesc” value=”Root Panel Group Layout”/>

22. Save the .jsff files and Re-zip the sandbox

23. Login to OIM /identity. Import the sandbox we re-created and active it.

24. To verify the change:

Catalog -> search for “MainframeAccess” -> add to cart ->checkout
‘Other’ text box should be only showing when ‘Other’ was selected from the dropdown.