03-27-2019 05:55 AM
I wrote this code in a webscript controller
var newFolderName="Configuration";
var newFolderNode=companyhome.childByNamePath(newFolderName);
if (newFolderNode === null) {
//which means newFolder does not exists, so create it
newFolderNode=companyhome.createFolder(newFolderName);
}
and I'm getting "companyhome" not defined. I found this post https://community.alfresco.com/thread/169855-companyhome-not-defined but it didn't fix the error.
03-27-2019 08:04 AM
I assume you are writing your web script on the Share-tier in a directory called site-webscripts, am I correct? Web scripts on the Share-tier do not have access to the Repository root scope objects. You need to write a Repository-tier web script for such objects to be used.
03-28-2019 12:35 AM
yes I am writing the web script on the Share-tier.
So I should write this code in a Repository-tier web script, then return an object that contains the new folder properties ?
Thanks.
03-28-2019 07:24 PM
Available root objects in Repository-tier webscript.
https://docs.alfresco.com/5.2/references/API-JS-rootscoped.html
Explore our Alfresco products with the links below. Use labels to filter content by product module.