AnsweredAssumed Answered

Javascript to create subfolder triggered by rule

Question asked by gmce on Jun 22, 2012
Latest reply on Jun 28, 2012 by gmce
Hallo everybody, i am just a noob in javascript development.

I need to create some specific subfolders when i create a folder, so i applyed a rule to the parent folder that execute a script when a folder is created.

The script is this:


var subfolder1 = space.childByNamePath("subfolder1");
if ( subfolder1== null && space.hasPermission("CreateChildren"))
{
   // create subfolder1  
subfolder1 = space.createFolder("subfolder1");
}
var subfolder2 = space.childByNamePath("subfolder2");
if ( subfolder2== null && space.hasPermission("CreateChildren"))
{
   // create subfolder2  
subfolder2 = space.createFolder("subfolder2");
}

The problem is that this script create the subfolders at the same level of the created folder and not inside it!

Can someone please help me?

Thanks in advance.

Outcomes