Saturday 28 March 2015

OAF: OA Dialog Page not working when FND Diagnostics Profile is not set

Many users have raised this question in OTN forum recently."When clicking on 'Ok' or 'No' button in OA Dialog Page, the page errors out if the FND Diagnostics profile is not set".

I have found 2 reasons for this and thought of putting this in a blog, so that it will help others.
  • If setPostToCallingPage(true) is set, then the processRequest() of the calling page will get called when the 'Ok' or 'No' button is pressed. so you should place the processRequest() inside a if condition as mentioned below, to avoid unexpected errors. This will avoid executing the code in processRequest when the OADialog page buttons are called. [Assuming "Yes" and "No" are the ButtonItemNames set using the below code. dialogPage.setOkButtonItemName("Yes"); dialogPage.setNoButtonItemName("No"); ]
 public void processRequest(OAPageContext pageContext, OAWebBean webBean) {  
      if ((pageContext.getParameter("Yes") == null) && pageContext.getParameter("No") == null) {     
           super.processRequest();    
           // Any additional custom code    
      }    
 }  

  • If the FND Diagnostics is not set, then                 pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM) is returning null. So in the code, you should always do a null check before you use the variable which gets the value from the above.

Wrong usage :
 String eventParam = pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM);  
 if (eventParam.equals("delete"))  
 {  
    // write the code here  
 }  
Correct usage:
 String eventParam = pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM);  
 if ("delete".equals(eventParam))  
 {  
     // write the code here  
 }  

Feel free to point out if anything is missing/wrong in this blog.

No comments:

Post a Comment