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/


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
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

