creating rule to delete node with sleep time is not working on folder

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

creating rule to delete node with sleep time is not working on folder

Hi All,

I am creating rule to delete node with sleep time is not working on folder.I just checked in java-script console it is working and same code is not working if apply through rule on folder. And also in that document is not able to delete in that sleep period.

var nodeRefs = companyhome.childByNamePath("Test");
if(nodeRefs!=null)
{
var nodes = nodeRefs.children;
for (var i=0; i<nodes.length; i++) {
sleep(50000);
if(nodes[i].isDocument)
{
nodes[i].remove();
}
console.log("i:"+i);
}
}

function sleep(delay) {
var start = new Date().getTime();
while (new Date().getTime() < start + delay);
}

3 Replies
kalpesh_c2
Senior Member

Re: creating rule to delete node with sleep time is not working on folder

Hi kkumar _‌,

Alfresco server side java script does not have console.log() function so it is preventing script to run.  You can use logger.log() by enabling ScriptLogger to show your logs in server logs.

Thanks,

Kalpesh

ContCentric

kranthi
Active Member II

Re: creating rule to delete node with sleep time is not working on folder

not able to open document when it's in sleep  50ms. Actually I am using this for print and download here once print/download is done document need to delete. 

mehe
Senior Member II

Re: creating rule to delete node with sleep time is not working on folder

It’s hard to understand what you want to achieve. I think this not the right way to handle a document after downloading/printing. Can you describe the „Workflow“ of the documents and the trigger of the rule.