cancel
Showing results for 
Search instead for 
Did you mean: 

Does rule on 'delete content' has been solved?

billydekid
Star Contributor
Star Contributor

Hi,

I'm on create a rule on folder which triggered when content deleted, but always fail (content move is success), until I found this old thread :

 

It's been a years issue as ‌ explained there.

Is there any info if this issue will be solved?

Thanks,

[bayu]

1 ACCEPTED ANSWER
6 REPLIES 6

mehe
Elite Collaborator
Elite Collaborator

I use a "on content deleted or moved" rule, and it's also working on deleting content. version is 5.2 community

billydekid
Star Contributor
Star Contributor

Hmm.... after reading your comments, I created a simple script to write a log file and works (move and deleted).

I will check my script again why it happens.

I also use 5.2 community version.

Thank you.-

Hi,

After check my script and the rule, I found the problem or might 'bug' finally.

The problem is on "Run in background" option of rule.

When it disabled, the the deleting action will trigger the rule, but when it activated/checked the deleting action will not trigger the rule.

Below is my simple script which will create the log file with time stamp.

Hi Martin Ehe, If you don't mind, I'd like you to test my script.

function main()
{
    var currentDate = new Date();
    var logFile = userhome.childByNamePath("myCreateLogs.txt");
    if (logFile == null) {
          logFile = userhome.createFile("myCreateLogs.txt");
    }

    var currentDate = new Date();
    logFile.content = "Log File: "+currentDate+"\n";
    logFile.content += "Folder Name="+space.properties.name;
}

main();

Thank you,

mehe
Elite Collaborator
Elite Collaborator

Hi Bayu,

You're right. The script is not executed if it's run in the background. It seems that the scripts are not triggered if "onDelete" is called in the background.

I even tried the "error" script mechanism, to see if there's a problem.

Tried your script and the script 

logger.system.out("rule called");

and an "error" script of the same complexity

logger.system.out("an error occurred");

When removing the "run in background" option, your script runs fine and creates the log file in my home-dir.

Seems like we have a bug...

billydekid
Star Contributor
Star Contributor

Hi Martin,

Thank you. If it hasn't been submitted to the bug report, I will report it.

Thanks!

It already submitted 16 Sep 2014: [SHA-1363] Add a warning in the Rules UI that "On Delete" rules won't run in the background - Alfres... 

Hope this issue will be solved sooner!