1 Reply Latest reply on Jul 6, 2011 8:54 AM by Jose Aróstegui

    Attachment Table with 2 PK columns using personalization

    Jose Aróstegui
      Hi Friends!

      Is it possible to add an attachment table just using personalization but using 2 PK columns?:

      entity_name: PA_DRAFT_INVOICES
      pk1_value: <project_id>
      pk2_value:     <draft_invoice_num>

      I've achieved to create it via personalizacion but I don't know how to add the second pk column. It works to add attachments and query them but only with one PK column. I've followed Anil's advices:

      [Attachments-self-service-oracle-apps|http://apps2fusion.com/apps-training/apps-functional-documents/75-ame-sshr/433-attachments-self-service-oracle-apps]

      In the other hand I've extended the Controller and added the Attachment Table programmatically with the 2 PK columns and I can upload attachments, BUT can't query them as the attachments region is empty. I've checked that record has been created OK in fnd_attached_documents table with this approach.

      Please help... what am I doing wrong???

      Thanks a lot in advance,
      Jose.

      This is the code for adding programmatically the Attachment Table:

      -----------------------------------------------------------------------------------
      OAAttachmentTableBean attTable = (OAAttachmentTableBean)pageContext.getWebBeanFactory().createWebBean(pageContext, OAWebBeanConstants.ATTACHMENT_TABLE_BEAN,null,null);

      attTable.setID("xxEverisDraftInvAttachmentId");
      attTable.setAutoCommitEnabled(true);
      attTable.setViewUsageName("InvDetailsVO");
      attTable.setSearchRegionDisplayed(false);
      attTable.setDocumentCatalogEnabled(false);

      attTable.setText("Upload Draft Invoice Extra Documentation");

      Dictionary firstEntity = new ArrayMap(4);
      firstEntity.put("entityId", "PA_DRAFT_INVOICES_ALL"); // entity id
      firstEntity.put("showAll", Boolean.FALSE); // show all property
      firstEntity.put("insertAllowed", Boolean.TRUE);
      firstEntity.put("deleteAllowed", Boolean.TRUE);
      firstEntity.put("updateAllowed", Boolean.TRUE);

      String[] pkAttrNames = new String[2];
      pkAttrNames[0] = "ProjectId"; // pk view attribute name
      pkAttrNames[1] = "DraftInvoiceNum"; // pk view attribute name
      firstEntity.put("pkColumns", pkAttrNames);

      Integer[] categories = new Integer[1]; // categories
      categories[0] = new Integer(1); //MISC

      firstEntity.put("categories", categories);
      String[] statuses = new String[2]; //attachment status filter
      statuses[0] = "pending";
      statuses[1] = "failed";

      firstEntity.put("statuses",statuses);
      Dictionary[] entityMaps = new Dictionary[1];
      entityMaps[0] = firstEntity;

      attTable.setEntityMappings(entityMaps);
      ------------------------------------------------------------------------------------