Root Objects : companyhome

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member

Root Objects : companyhome

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.

3 Replies
Highlighted
Master

Re: Root Objects : companyhome

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.

Highlighted
Active Member

Re: Root Objects : companyhome

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.

Highlighted
Senior Member II

Re: Root Objects : companyhome

Available root objects in Repository-tier webscript.

https://docs.alfresco.com/5.2/references/API-JS-rootscoped.html

Thanks & Regard,
Sanjay