ScriptNode actions: before or after file created/deleted

cancel
Showing results for 
Search instead for 
Did you mean: 
billydekid
Established Member II

ScriptNode actions: before or after file created/deleted

Jump to solution

Hi,

I developed a script which triggered when items created or deleted. Its function is only to check whether a folder (container) is having a document (isDocument) or not. I use the traverse/recursive method to check.

After do some iterate checks and read my logs, I found that the behavior on how the sequence of "file/document activities" and "script is executed".

- When items is created, the activities of file created or moved into a directory is running first then the script will run afterwards;

- When items is deleted, the script will run first (and will capture whole the structures), then file activities will run (deleted or move into another places)

With above situations, I have a trouble when there's 1 (one) file inside a folder, I delete it, next the script will run and reported that it's still found one file inside that folder. Instead of no file found in that folder.

If items are created is working fine as expected.

What is the right method or approach of my problem above?

My script is attached.

Thanks,

[bayu]

1 Solution

Accepted Solutions
douglascrp
Advanced II

Re: ScriptNode actions: before or after file created/deleted

Jump to solution

If what you need is to execute your code only after the node is really deleted, then you should consider using behaviours.

You can find value information about this topic in this blog post Alfresco – Implementing delete behavior | Programming and So 

View solution in original post

2 Replies
douglascrp
Advanced II

Re: ScriptNode actions: before or after file created/deleted

Jump to solution

If what you need is to execute your code only after the node is really deleted, then you should consider using behaviours.

You can find value information about this topic in this blog post Alfresco – Implementing delete behavior | Programming and So 

billydekid
Established Member II

Re: ScriptNode actions: before or after file created/deleted

Jump to solution

Hi Douglas,

Thank you to pointing out -- to that blog.