Get Started

Fusion SaaS AppUI: Enable Groovy-only solution for SOAP based ErpObjectAttachmentService

Groovy-Only Attachment Service: REST-ready ErpObjectAttachmentService for VB AppUIs

General

This post further extends the solution of exposing Visual Builder AppUI ready REST APIs on Fusion backend for business entities that do not have such REST APIs out-of-the-box.
The previous post used Application Composer, Custom Object, Groovy and OIC.
The solution below uses Groovy-only implementation leveraging internal URL https://fa-internal.oracleoutsourcing.com:10663 and SOAP based ErpObjectAttachmentService.
Such a solution can be deployed to PROD and will work without any changes in lower environments after P2T process.
Similar approach is also described in https://cidsolutions.com/2024/11/03/fusion-saas-implement-p2t-hassle-free-generic-sql-query-rest-utility-for-vb-appuis-by-using-bip-and-app-composer/

Implementation Details

  1. Use sandbox with Application Composer to define Web Service connection for SOAP service ErpObjectAttachmentService by pointing it to the following URL:
    https://fa-internal.oracleoutsourcing.com:10663/fscmService/ErpObjectAttachmentService?wsdl
    Screenshot 2024 12 24 at 23.06.37
  2. Extend the Rest Util custom object by adding 2 methods – downloadAttachmentFile and uploadAttachmentFile
    Screenshot 2024 12 24 at 23.11.23
  3. Download function – marked Callable by External Systems:
    Screenshot 2024 12 24 at 23.13.26
    def attachmentRequest =
    [
      EntityName : EntityName,
      CategoryName: CategoryName,
      UserKeyA: UserKeyA,
      UserKeyB: UserKeyB,
      UserKeyC: UserKeyC,
      UserKeyD: UserKeyD,
      UserKeyE: UserKeyE 
    ];
    
    def appParams = '';
    def result = [:]
    
    try {
      def res = adf.webServices.LocalAttachmentService.downloadAttachment(attachmentRequest, appParams);
      if (res?.FileName) result.fileName = res.FileName
      if (res?.AttachmentContent) result.attachmentContent = res.AttachmentContent
    }
    catch (e) {
    }
    
    return result
    
  4. Upload function – marked Callable by External Systems:
    Screenshot 2024 12 24 at 23.21.43
    def result = [:]
    def attachmentRows =
    [[
      UserKeyA: UserKeyA,
      UserKeyB: UserKeyB,
      UserKeyC: UserKeyC,
      UserKeyD: UserKeyD,
      UserKeyE: UserKeyE,
      AttachmentType: "File",
      Title: Title,
      Content: Content,
    ]]
    
    def res = adf.webServices.LocalAttachmentService.uploadAttachment(entityName, categoryName, "Yes", attachmentRows)
    result = res
    
  5. Use the methods above inside JavaScript action chains.
    Download:
    Screenshot 2024 12 24 at 23.27.19

    Upload:
    Screenshot 2024 12 24 at 23.28.43
Table of Contents

Leave a Reply

Your email address will not be published. Required fields are marked *