Search This Blog

Monday, October 28, 2013

Attachment Issue in OAF


If you use item of type AttachmentImage, when you click on Add Attachment/ Update Attachment/ Delete attachment/View Attachment you will be re-directed to the Attachment Page. When you are coming back to Actual page(from attachment page), page will be refreshed and you will lost all the changes done.
Following fix will resovle this issue: 

Write Below code in your Process Form Request immediately after super.processFormRequest(pageContext,webBean);

****************************************************************
if("oaAddAttachment".equals(pageContext.getParameter(event)) ||
"oaUpdateAttachment".equals(pageContext.getParameter(event)) ||
"oaDeleteAttachment".equals(pageContext.getParameter(event)) ||
"oaViewAttachment".equals(pageContext.getParameter(event)) )
{
System.out.Println("Attachement Event Raised");
pageContext.putSessionValue("returnAttachmentFlag","Y");
} //If-> Attachment Event
****************************************************************

Write Following code in your processRequest():

****************************************************************
String returnAttachmentFlag = (String)pageContext.getSessionValue("returnAttachmentFlag");
if(returnAttachmentFlag!= null && returnAttachmentFlag.equals("Y"))
{
//Do not execute Your VOs
System.out.println("Page Refresh after Attachement Event hence not executing VOs");
}

else
{
//Execute VOs
vo.executeQuery();
}
pageContext.putSessionValue("returnAttachmentFlag","N");
****************************************************************

No comments:

Post a Comment