Search This Blog

Thursday, October 10, 2013

Adding Attachments to OA Page

Adding Attachments to OA Page:

1. In your Advanced Table(/Table) Region.
2. Create a new Column
3. Create an Item of type -> attachmentImage
4. By default one entity map will be created.
Set the property, Entity in this item to some text. ->> Example: Your Project Name to identify the attachments easily
5. Right Click on entityMap1, select new  primaryKeys
Set the Property View Attribute to Primar Column in your table(from the VO that attached to the Advanced Table RN)
6. Create a Sortable Header to give the column Name as Attachments

Now, run the page. You can view/create/update/delete attachments using this option.

To make Attachment Read-Only:

OAAttachmentImageBean attachBean = (OAAttachmentImageBean)webBean.findChildRecursive("<ID of your attachmentImage Item>");
Dictionary[] entityMaps = attachBean.getEntityMappings();
if(entityMaps != null)
int mapLength = entityMaps.length;
for(int i= 0; i< mapLength; i++)
Dictionary entityData = entityMaps[i];
if(entityData!=null && entityData.size() > 0)
entityData.put("insertAllowed", false);
entityData.put("updateAllowed", false);
entityData.put("deleteAllowed", false);
} //Entity Data Not NULL
} //FOR Loop
} //Entity Maps Not NULL

To Hide the Attachment:
OAAttachmentImageBean attachBean = (OAAttachmentImageBean)webBean.findChildRecursive("<ID of your attachmentImage Item>");


  1. How can we make adding attachment in the attachment table mandatory?

    1. we can make mandatory by Coding and throwing Exception Only!

  2. ViewObject dv = am.getOADBTransaction().createViewObjectFromQueryStmt("select count(*) from fnd_attached_documents o where o.entity_name ='AtpInSvc' and o.pk1_value=" + vHeaderId);

    vCount = Integer.parseInt(dv.getCurrentRow().getAttribute(0).toString());
    catch (Exception e)
    vCount = 0;


    if (vCount == 0)

    throw new OAException("Attachment is Mandatory", OAException.ERROR);