I have created a js
file to create folders when creating an event in Alfresco
. But the problem is, when I create an event on the Alfresco
site, it will automatically create a folder in a shared folder. That's a problem because when updating an existing event it creates a new folder without removing the existing folder. Also, when I delete an event it will not delete the corresponding folder.
How can I solve this problem?
Here is my code to create a new folder when an item is created:
// create a new folder in the same space
var folderNode = space.createFolder(document.properties["ia:whatEvent"]);
// copy the doc into the newly created folder node
//var copy = document.copy(folderNode);
// move the folder node to companyhome
var objDestFolder = companyhome.childByNamePath("Shared/SECRETARY/COMMISSION_PAPER_RECEIVED");
folderNode.move(objDestFolder);