cancel
Showing results for 
Search instead for 
Did you mean: 

ScriptNode actions: before or after file created/deleted

billydekid
Star Contributor
Star Contributor

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 ACCEPTED ANSWER

douglascrp
World-Class Innovator
World-Class Innovator

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 answer in original post

2 REPLIES 2

douglascrp
World-Class Innovator
World-Class Innovator

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 

Hi Douglas,

Thank you to pointing out -- to that blog.