var docResult = StructNew(); var docComponent = server.CommonSpot.api.getObject('UploadedDocument'); try { // UploadedDocument.delete() returns VOID docComponent.delete(id=arguments.csPageID, ignoreWarnings=arguments.ignoreWarnings); docResult["CMDSTATUS"] = true; docResult["CMDRESULTS"] = true; } catch (any e) { docResult["CMDSTATUS"] = false; if ( StructKeyExists(e,"Reason") AND StructKeyExists(e['Reason'],"pageID") ) docResult["CMDRESULTS"] = e['Reason']['pageID']; else if ( StructKeyExists(e,"message") ) docResult["CMDRESULTS"] = e.message; else docResult["CMDRESULTS"] = e; } return docResult; var pageCmdResult = StructNew(); var commandArgs = StructNew(); commandArgs['Target'] = "UploadedDocument"; commandArgs['method'] = "delete"; commandArgs['args'] = StructNew(); commandArgs['args'].id = arguments.csPageID; commandArgs['args'].ignoreWarnings = arguments.ignoreWarnings; try { // Returns Void variables.apiRemote.runCmdApi(commandStruct=commandArgs,authCommand=true); pageCmdResult["CMDSTATUS"] = true; pageCmdResult["CMDRESULTS"] = true; } catch ( any e ) { pageCmdResult["CMDSTATUS"] = false; if ( StructKeyExists(e,"Reason") AND StructKeyExists(e['Reason'],"pageID") ) pageCmdResult["CMDRESULTS"] = e['Reason']['pageID']; else if ( StructKeyExists(e,"message") ) pageCmdResult["CMDRESULTS"] = e.message; else pageCmdResult["CMDRESULTS"] = e; } return pageCmdResult; var docResult = StructNew(); var docComponent = server.CommonSpot.api.getObject('UploadedDocument'); var newConfidentialityID = 0; var newShowInList = "PageIndex,SearchResults"; var newExpirationDate = ""; var newExpirationAction = ""; var newExpirationRedirectURL = ""; var newExpirationWarningMsg = ""; var newMetadata = ArrayNew(1); // Convert PUBLICRELEASEDATE to publicationDate if it exists if ( !StructKeyExists(arguments.docData,"publicationDate") AND StructKeyExists(arguments.docData,"PublicReleaseDate") ) arguments.docData.publicationDate = arguments.docData.PublicReleaseDate; // Build the Optional Field Nodes if ( StructKeyExists(arguments.docData,"confidentialityID") ) newConfidentialityID = arguments.docData.confidentialityID; if ( StructKeyExists(arguments.docData,"showInList") ) newShowInList = arguments.docData.showInList; if ( StructKeyExists(arguments.docData,"expirationDate") ) newExpirationDate = arguments.docData.expirationDate; if ( StructKeyExists(arguments.docData,"expirationAction") ) newExpirationAction = arguments.docData.expirationAction; if ( StructKeyExists(arguments.docData,"expirationRedirectURL") ) newExpirationRedirectURL = arguments.docData.expirationRedirectURL; if ( StructKeyExists(arguments.docData,"expirationWarningMsg") ) newExpirationWarningMsg = arguments.docData.expirationWarningMsg; if ( StructKeyExists(arguments.docData,"metadata") ) newMetadata = arguments.docData.metadata; try { // page.SaveInfo returns VOID docComponent.saveInfo(id=arguments.docData.id, title=arguments.docData.title, publicationDate=arguments.docData.publicationDate, categoryID=arguments.docData.categoryID, description=arguments.docData.description, confidentialityID=newConfidentialityID, showInList=newShowInList, expirationDate=newExpirationDate, expirationAction=newExpirationAction, expirationRedirectURL=newExpirationRedirectURL, expirationWarningMsg=newExpirationWarningMsg, metadata=newMetadata); // Check the return status has a LENGTH docResult["CMDSTATUS"] = true; docResult["CMDRESULTS"] = "Success: Document Metadata info was successfully saved."; } catch (any e) { docResult["CMDSTATUS"] = false; docResult["CMDRESULTS"] = "Failed: Document Metadata info was not saved."; docResult["CFCATCH"] = e; } return docResult;