cancel
Showing results for 
Search instead for 
Did you mean: 

Root Objects : companyhome

riadhazzouz
Confirmed Champ
Confirmed Champ

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 3

afaust
Legendary Innovator
Legendary Innovator

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.

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.

sanjaybandhniya
Elite Collaborator
Elite Collaborator

Available root objects in Repository-tier webscript.

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

Getting started

Explore our Alfresco products with the links below. Use labels to filter content by product module.