Tuesday, February 7, 2017

Attachments in detail in OAF

Attachments are linked with the VOs primary key (could be combination of columns).
When an attachment is stored, the values of these primary keys and the Entity ID are stored so the attachments can be uniquely retrieved.

attachmentTable   -     for Attachments table
attachmentLink     -     for View List link and Add button
MessageInlineAttachment   -   for inline attachment links
attachmentImage           -      For Attachment column in Table and Advance Table

1. Specify View Instance property 
2. Select the default entityMap that is created under the attachment region item, set the Entity value to some unique value which will be used to identify all      
attachments.
3. Right Click on Entity Map and Add primary keys and specify the primary keys used to identify the attachment uniquely.

Tables:  

select * from fnd_attached_documents where entity_name = 'XXSL_GROUP' ;

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

IN PR:
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");

1 comment: