I have a custom service /hayts the processes file uploads and metadata.
the same files work when following the MultiPart Forms Tutorial.
However, when I bundle the files into My Share application. I can load the form submit it to upload the file. But the POST processing JS fails.
The Web Script /share/page/hayts has responded with a status of 500 - Internal Error.
500 Description: An error inside the HTTP server which prevented it from fulfilling the request.
Message: 11120001 Failed to execute script 'classpath*:alfresco/web-extension/site-webscripts/com/github/raystorm/smalgyax/hayts/hayts.post.js': 11120000 ReferenceError: "companyhome" is not defined. (jar:file:/usr/local/tomcat/webapps/share/WEB-INF/lib/smalgyax-share-1.0.0-SNAPSHOT.jar!/alfresco/web-extension/site-webscripts/com/github/raystorm/smalgyax/hayts/hayts.post.js#35)
Server: Spring WebScripts - v7.10.0 schema 1,000
For the following line: upload = companyhome.createFile(file.filename, type);
Why does it work when ingested via the UI at /alfresco/service/multipart but not for my share service version /share/service/hayts?
Alfresco and Share and not the same thing as you probably know, Alfresco being the platform and Share being the user interface.
So root object available to either are not the same.
https://docs.alfresco.com/6.1/references/APISurf-rootscoped.html
https://docs.alfresco.com/4.2/references/API-JS-rootscoped.html