02-05-2018 07:13 AM
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);
}
02-06-2018 02:07 AM
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
02-06-2018 02:11 AM
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.
02-06-2018 07:53 AM
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.
Explore our Alfresco products with the links below. Use labels to filter content by product module.