OAF, R12

Dynamically Adding Update Icon in OAF

Dynamically adding update icon or any other icon for that matter is something you will need to do when you have to show it on the basis of some condition which has to be decided at run time. Or in some cases to show it at places where OAF personalization is not allowing you to do so. In this post we will take the example of adding an Update Icon ( Pencil Icon) on Supplier page.

Navigation and Standard Page

Navigation of the page is: PO Buyer –> Buyer Work Center –> Suppliers –> Search for the supplier –> Click on Update button. Below is the screenshot how does the page look like in standard form:

Dynamically Adding Update Icon
Standard Supplier Page


To dynamically add the update icon, we need to find out the bean in which we need to show it. Lets say that we want to show it in the layout which contains fields like “Supplier Name”, “Supplier Number”. So we click on link “Personalize Table Layout: (SuppDetailsRN). And structure of the table layout opens which look something like this:

Dynamically Adding Update Icon
Table Layout Structure

From this image above it is clear that we need to do the add the icon in “Message Component Layout: (LeftMCL)”.

By the way, Here ( India) or Here ( Other Geographies) are few UNCONVENTIONAL tricks which I have learnt to improve the performance of BI reports or SQL queries. Try them only when nothing else works.. kind of SOS...
https://www.amazon.in/gp/product/B093CC1CLD?ie=UTF8&tag=oraclebytes-21&camp=3638&linkCode=xm2&creativeASIN=B093CC1CLD

so now that we know the place we need to show it, we need to create a custom controller and add this code in the “Process Request” method of it. Below is the code which you can use. Key points are:

  • Find out the bean in which you want to add the icon
  • Create the image bean dynamically
  • Set the ID of the newly created bean
  • Set the Image Source. This image source is the file path and file name in $JAVA_TOP folder. Generally you would be picking it from OA_MEDIA folder, just like it is done in the example below.

Code Snippet

//Find Out the bean in which you need to add the icon
OAMessageComponentLayoutBean LeftMCLBean = (OAMessageComponentLayoutBean)webBean.findChildRecursive ("LeftMCL");
//Create an Image type of Bean.. Here "updateIconBean1" should be unique value for any bean getting created.. 
OAImageBean updateIconBean1 =  (OAImageBean)pageContext.getWebBeanFactory().createWebBean(pageContext, OAWebBeanConstants.IMAGE_BEAN , null,"updateIconBean1");    
//Set the Id of newly created bean
 updateIconBean1.setID("updateIconBean1");
//Set the label of the icon. This is the value which will be visible when you hover your mouse on the icon
updateIconBean1.setLabel("Update Icon Label");
//Set the source of the image i.e. the icon which you need to show. Please note that this file updateicon_enabled.gif must be available in OA_MEDIA folder. if the image lies in further subfolder, alter the path accordingly 
updateIconBean1.setSource("/OA_MEDIA/updateicon_enabled.gif");    
//Attach the dynamically created bean to the parent.. Here 0 shows the index at which image will be added. 0 means first child. you can move the image up or down using this number. just count the children which you want above your icon, subtract 1 , and that is your number that you need to use here. 
 LeftMCLBean.addIndexedChild(0,updateIconBean1);        

And this is how the outcome looks like..

Dynamically Adding Update Icon
Dynamically Adding the Update Icon

Related Posts

Dynamically Adding External URL in OAF

Reference:
support.oracle.com

Feedback:
Hope the article helped you. If it did, please rate the post. In case it didn’t, do leave a comment to let us know what did we miss.

How useful was this post?

Click on a star to rate it!

Average rating 1 / 5. Vote count: 59

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

1 thought on “Dynamically Adding Update Icon in OAF”

Comments are closed.