Tuesday, December 12, 2017

OAF Attachment : Make an attachment mandatory

at times you want to make an EBS OAF attachment mandatory for user. We cannot use queries to retrieve if attachment is added by the user or not because attachments are not yet committed to database.


In such scenario you do a mandatory (required) check for attachment table, link and inline attachment using the below code:

    private void validateAttachment(OAApplicationModule am) {
        OAAttachmentsAMImpl attachmentAM =
            (OAAttachmentsAMImpl)am.findApplicationModule("oracle_apps_fnd_server_OAAttachmentsAM");
        OAViewObjectImpl attachVO =
            (OAViewObjectImpl)attachmentAM.findViewObject("Attach_0_FndAttachedDocumentsDomExtensionVO");
        int count = attachVO.getFetchedRowCount();
        if (count <= 0) {
            throw new OAException("Please attach supporting documents.",
                                  OAException.ERROR);
        }
    }



1 comment:

  1. Hi, Can you please suggest where i need to insert this code

    ReplyDelete